How does jprobes/kprobes work ?

Ananth N Mavinakayanahalli ananth@in.ibm.com
Tue Mar 15 15:05:00 GMT 2005


On Mon, Mar 14, 2005 at 03:30:15PM -0800, Badari Pulavarty wrote:
> Hi,
> 
> I am just wondering how does jprobes provide the arguments
> to the function if I enable IRQ_STACKS on PPC64 or
> 4KSTACKS on i386 ? This forces the interrupt to be taken
> on a per-processor stacks, there by loosing original stack.

CONFIG_IRQSTACKS is default on in pSeries defconfig.

> Does the code go thro the trouble of finding out the original
> stack and copy it for arguments ?

When the kprobe (which is what lies underneath, even if its a jprobe
hit), will "trap" and the pt_regs snapshot at the time of the probe hit
is captured. Since, on ppc64, all args are passed in registers, we still
have access to the function arguments necessary and we don't need to
play with the stack at all. Upon a jprobe_return(), which again will 
"trap", we recognize that we are here due to a jprobe_return() and then 
restore back the original pt_regs and continue.

Thanks,
Ananth



More information about the Systemtap mailing list