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]

Improvement for post-handler only case in kprobes


Hello,

I am reviewing the code of kprobes, and have an idea. Is there any
case we need only post-handler for a probe, but not pre-handler? If
that is the case, i think it is possible to improve the performance in
the similar approach with kprobe-booster.

For the moment, if the probe has only post-handler, we need to switch
out 2 times:
1. When the probe is hit, we switch out with BreakPoint instruction.
The processor is the put into Single-step mode.
2. After single-step, we switch out again.

In case we only has post-handler (NOT pre-handler), we can eliminate
the single-mode step in the following way:
- Still put BreakPoint at the registered address.
- After the single-step, remove the old BreakPoint and put it at the
current EIP (this is the place we switch out with single-step). Next
time, we only need to handle the breakpoint, as it is hit right after
the "original" breakpoint. Hence we dont need to get into the
single-step mode any more. Of course this improves the performance.

Of course if we analyze the instruction at the original address when
registering the probe, we can find the next instruction. But with the
above scheme we dont need to do that, with the price of 1 single-step
for the first time the probe is hit.

Any comment? Is this worth implementing?

Regards,
Jun


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