This is the mail archive of the
mailing list for the systemtap project.
Preemption-safe kprobe-booster(Re: [PATCH]kprobe booster for IA64)
- From: Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>
- To: Keshavamurthy Anil S <anil dot s dot keshavamurthy at intel dot com>
- Cc: Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, SystemTAP <systemtap at sources dot redhat dot com>, Yumiko Sugita <yumiko dot sugita dot yf at hitachi dot com>, Satoshi Oshima <soshima at redhat dot com>, Hideo Aoki <haoki at redhat dot com>, Prasanna S Panchamukhi <prasanna at in dot ibm dot com>, Jim Keniston <jkenisto at us dot ibm dot com>
- Date: Wed, 12 Jul 2006 15:22:37 +0900
- Subject: Preemption-safe kprobe-booster(Re: [PATCH]kprobe booster for IA64)
- Organization: Systems Development Lab., Hitachi, Ltd., Japan
- References: <4485223C.firstname.lastname@example.org> <20060628190541.A13874@unix-os.sc.intel.com> <44AAF207.email@example.com>
Masami Hiramatsu wrote:
> Hi, Anil
> Keshavamurthy Anil S wrote:
>> pre_preempt_count will always be one here, since
>> So currently you might be preparing for boosting even for
>> preemptable code path. Can you verify this.
> Thank you for the advice!
> I hadn't realized it. Now, I verified it and had some ideas.
> The problem comes from reusing the insn buffer, because
> there might be some processes sleeping on the buffer.
> So, I think we can avoid this problem as below:
> First, we disable a kprobe (remove the break). Next,
> wait until all preempted processes are waken up. And Last,
> we release its insn buffer to reuse. Then, it will be safe.
> Because there is no process slept on the buffer.
> For this purpose, I'd like to use stop_machine_run().
I and Oshima-san found that stop_machine_run() was not enough
to ensure safety. Instead of that, we focused on synchronize_sched().
As far as we know, this function waits until all processes
are expired. And any preempted processes can't be expired, only
the processes who are scheduled by itself are expired.
This means these processes already left from kprobe's slots.
So, after that, we can release/reuse these slots safely.
> However we can't execute it each releasing time because
> it is very costly.
synchronize_sched() is also costly.
> I think we can resolve it by using garbage collector.
> I describe my idea below:
> The kprobe frees its insn slot(buffer) after disable it.
> Thus, when an insn slot is freed, it will be just marked as
> a garbage. And when get_insn_slot() can't find any free slot,
> it will call the garbage collector to try to refill free slots.
And the garbage collector uses synchronize_sched() to ensure safety.
> What do you think about this idea?
> Best regards,
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory