This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[RFC PATCH 1/3] Djprobe improvement patches (Re: Dynamic djprobe)
- From: Masami Hiramatsu <hiramatu at sdl dot hitachi dot co dot jp>
- To: Masami Hiramatsu <hiramatu at sdl dot hitachi dot co dot jp>
- Cc: systemtap at sources dot redhat dot com, "Keshavamurthy, Anil S" <anil dot s dot keshavamurthy at intel dot com>, Roland McGrath <roland at redhat dot com>, Richard J Moore <richardj_moore at uk dot ibm dot com>, Andi Kleen <ak at muc dot de>, michel dot dagenais at polymtl dot ca, Mathieu Desnoyers <compudj at krystal dot dyndns dot org>, "Frank Ch. Eigler" <fche at redhat dot com>, Karim Yaghmour <karim at opersys dot com>, Satoshi Oshima <soshima at redhat dot com>, Hideo Aoki <haoki at redhat dot com>, Yumiko Sugita <sugita at sdl dot hitachi dot co dot jp>
- Date: Wed, 03 Aug 2005 02:07:24 +0900
- Subject: [RFC PATCH 1/3] Djprobe improvement patches (Re: Dynamic djprobe)
- References: <42EA740A.10601@sdl.hitachi.co.jp>
Hi,
This patch solves 1st problem that djprobe works on non (or
voluntary)-preemptive kernel.
So, I decided to emulate djprobe by using kprobe when CONFIG_PREEMPT is
enabled.
This patch corrects dependency of CONFIG_DJPROBE, and provides
djprobe-compatible interface when CONFIG_DJPROBE is disabled.
Thanks,
--
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: hiramatu@sdl.hitachi.co.jp
arch/i386/Kconfig.debug | 2 +-
include/linux/kprobes.h | 45 +++++++++++++++++++++++++++++++--------------
2 files changed, 32 insertions(+), 15 deletions(-)
diff -Narup linux-2.6.12-djprobe/arch/i386/Kconfig.debug linux-2.6.12-djprobe.2/arch/i386/Kconfig.debug
--- linux-2.6.12-djprobe/arch/i386/Kconfig.debug 2005-08-01 22:00:17.000000000 +0900
+++ linux-2.6.12-djprobe.2/arch/i386/Kconfig.debug 2005-08-01 22:00:46.000000000 +0900
@@ -31,7 +31,7 @@ config KPROBES
config DJPROBE
bool "Direct Jump Probe"
- depends on KPROBES
+ depends on KPROBES && !PREEMPT
help
Djprobe is ultra-light probing system. This uses a jmp opecode
instead of an int3 trap opecode. Djprobe is useful for probing
diff -Narup linux-2.6.12-djprobe/include/linux/kprobes.h linux-2.6.12-djprobe.2/include/linux/kprobes.h
--- linux-2.6.12-djprobe/include/linux/kprobes.h 2005-08-01 22:00:17.000000000 +0900
+++ linux-2.6.12-djprobe.2/include/linux/kprobes.h 2005-08-02 19:53:11.000000000 +0900
@@ -105,6 +105,9 @@ typedef void (*djprobe_handler_t)(struct
* Direct Jump probe interface structure
*/
struct djprobe {
+#ifndef CONFIG_DJPROBE
+ struct kprobe kp;
+#endif
/* location of the probe point */
void * addr;
@@ -146,6 +149,31 @@ int register_jprobe(struct jprobe *p);
void unregister_jprobe(struct jprobe *p);
void jprobe_return(void);
+#ifdef CONFIG_DJPROBE
+extern int arch_prepare_djprobe_instance(struct djprobe_instance *djpi,
+ unsigned long size);
+extern int djprobe_bypass_handler(struct kprobe * kp, struct pt_regs * regs);
+extern void arch_uninstall_djprobe_instance(struct djprobe_instance *djpi);
+extern void schdule_release_djprobe_instance(void);
+
+int register_djprobe(struct djprobe *p);
+void unregister_djprobe(struct djprobe *p);
+#else
+static inline int register_djprobe(struct djprobe *p)
+{
+ if (p!=NULL) {
+ p->kp.addr = p->addr;
+ p->kp.pre_handler = (kprobe_pre_handler_t)p->handler;
+ return register_kprobe(&p->kp);
+ }
+ return -EINVAL;
+}
+static inline void unregister_djprobe(struct djprobe *p)
+{
+ unregister_kprobe(&p->kp);
+}
+#endif
+
#else
static inline int kprobe_running(void)
{
@@ -168,25 +196,14 @@ static inline void unregister_jprobe(str
static inline void jprobe_return(void)
{
}
-#endif
-
-#ifdef CONFIG_DJPROBE
-extern int arch_prepare_djprobe_instance(struct djprobe_instance *djpi,
- unsigned long size);
-extern int djprobe_bypass_handler(struct kprobe * kp, struct pt_regs * regs);
-extern void arch_uninstall_djprobe_instance(struct djprobe_instance *djpi);
-extern void schdule_release_djprobe_instance(void);
-
-int register_djprobe(struct djprobe *djp);
-void unregister_djprobe(struct djprobe *djp);
-#else
-static inline int register_djprobe(struct djprobe *djp)
+static inline int register_djprobe(struct djprobe *p)
{
return -ENOSYS;
}
-static inline void unregister_djprobe(struct djprobe *djp)
+static inline void unregister_djprobe(struct djprobe *p)
{
}
#endif
+
#endif /* _LINUX_KPROBES_H */