public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][fix] kprobe-booster disabling at preemptive kernel
@ 2006-07-16 15:13 Masami Hiramatsu
  0 siblings, 0 replies; only message in thread
From: Masami Hiramatsu @ 2006-07-16 15:13 UTC (permalink / raw)
  To: Andrew Morton, Ananth N Mavinakayanahalli, Keshavamurthy, Anil S,
	Prasanna S Panchamukhi
  Cc: bibo,mao, SystemTAP, Jim Keniston, Yumiko Sugita, Satoshi Oshima,
	Hideo Aoki

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-16 15:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-16 15:13 [PATCH][fix] kprobe-booster disabling at preemptive kernel Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).