This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][Patch 2/2][take2]kprobe: kprobe-booster against 2.6.14-mm1 for i386


Hi, Anil

Keshavamurthy, Anil S wrote:
>>You are correct. I had misunderstood the synchronize_sched().
>>I read the RCU code again, and I understood that the 
>>synchronize_sched()
>>is enough to check safety of the kprobe-booster.
>>So, previous kprobe-booster patch is safe, but it is for old 
>>-mm kernel.
>>I update and post it again soon.
>>
> 
> In previous kprobe-booster patch, I did not see the config option 
> where you enable kprobe-booster only if kernel preemption is disabled.
> So are you going to include this in your new patch?

Yes, I'm going to include the following fix which I posted previously.
With this fix, kprobes checks preempt_count before boosting.

When preempt_count == 1, this kernel thread becomes
preemptable after calling preempt_enable_no_resched().
Then the kernel thread can be preempted on the instruction
buffer. So, we must disable boosting in this case.

This is simpler than disabling whole of booster-patch
on preemptable kernel.


-------- Original Message --------
Subject: Re: [RFC][Patch 2/2][take2]kprobe: kprobe-booster against 2.6.14-mm1  for i386
Date: Tue, 06 Dec 2005 14:27:23 +0900
From: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>
To: systemtap@sources.redhat.com
CC: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>,        Yumiko Sugita <sugita@sdl.hitachi.co.jp>,        Satoshi Oshima <soshima@redhat.com>, Hideo Aoki <haoki@redhat.com>,
"Keshavamurthy, Anil S" <anil.s.keshavamurthy@intel.com>,        ananth@in.ibm.com
References: <43870DDB.8020306@sdl.hitachi.co.jp> <438B142B.5080407@sdl.hitachi.co.jp> <438B148F.9000004@sdl.hitachi.co.jp> <438B14E1.3010301@sdl.hitachi.co.jp>

Hi,

I forgot to enable preemption in previous booster patch.
With this fix, the booster can work safely on the preemptible
kernel.
For safety, the booster is enabled only if the pre-handler
of kprobe is called from where the preemption is prohibited.

Masami Hiramatsu wrote:
> @@ -235,6 +283,14 @@ static int __kprobes kprobe_handler(stru
>  		/* handler has already set things up, so skip ss setup */
>  		return 1;
>
> +	if (p->ainsn.boostable == 1 &&

#ifdef CONFIG_PREEMPT
	    preempt_count() != 1 &&
#endif

> +	    !p->post_handler && !p->break_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;
> +	}
> +
>  ss_probe:
>  	prepare_singlestep(p, regs);
>  	kcb->kprobe_status = KPROBE_HIT_SS;


-- 
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: hiramatu@sdl.hitachi.co.jp


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]