This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH][fix] kprobe-booster disabling at preemptive kernel
- From: Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>
- To: Andrew Morton <akpm at osdl dot org>, Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, "Keshavamurthy, Anil S" <anil dot s dot keshavamurthy at intel dot com>, Prasanna S Panchamukhi <prasanna at in dot ibm dot com>
- Cc: "bibo,mao" <bibo dot mao at intel dot com>, SystemTAP <systemtap at sources dot redhat dot com>, Jim Keniston <jkenisto at us dot ibm dot com>, Yumiko Sugita <sugita at sdl dot hitachi dot co dot jp>, Satoshi Oshima <soshima at redhat dot com>, Hideo Aoki <haoki at redhat dot com>
- Date: Mon, 17 Jul 2006 00:13:14 +0900
- Subject: [PATCH][fix] kprobe-booster disabling at preemptive kernel
- Organization: Systems Development Lab., Hitachi, Ltd., Japan
Hi, Andrew
Here is a patch to disable the kprobe-booster in the case of
preemptive kernel.
The kprobe-booster's safety check against preemption does not
work well now, because the preemption count has been modified
by read_rcu_lock() in atomic_notifier_call_chain() before we
check it.
So, I'd like to prevent boosting kprobe temporarily if the
kernel is preemptable.
Now we are searching for the good solution.
Best Regards,
--
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
kprobes.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --exclude=CVS -Narup a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
--- a/arch/i386/kernel/kprobes.c 2006-07-10 12:11:43.000000000 +0900
+++ b/arch/i386/kernel/kprobes.c 2006-07-10 15:41:17.000000000 +0900
@@ -256,11 +256,6 @@ static int __kprobes kprobe_handler(stru
int ret = 0;
kprobe_opcode_t *addr;
struct kprobe_ctlblk *kcb;
-#ifdef CONFIG_PREEMPT
- unsigned pre_preempt_count = preempt_count();
-#else
- unsigned pre_preempt_count = 1;
-#endif
addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t));
@@ -338,13 +333,15 @@ static int __kprobes kprobe_handler(stru
return 1;
ss_probe:
- if (pre_preempt_count && p->ainsn.boostable == 1 && !p->post_handler){
+#ifndef CONFIG_PREEMPT
+ if (p->ainsn.boostable == 1 && !p->post_handler){
/* Boost up -- we can execute copied instructions directly */
reset_current_kprobe();
regs->eip = (unsigned long)p->ainsn.insn;
preempt_enable_no_resched();
return 1;
}
+#endif
prepare_singlestep(p, regs);
kcb->kprobe_status = KPROBE_HIT_SS;
return 1;