Re: [PATCH 0/7][RFC] function graph tracer port to PowerPC

From: Steven Rostedt
Date: Wed Feb 11 2009 - 21:38:13 EST



On Thu, 12 Feb 2009, Michael Ellerman wrote:
> >
> >
> > The function graph tracer not only traces the start of a function
> > (uses the function tracer part for that) but also uses the kprobes
> > trick to replace the return address with a hook to trace the exit
> > of the function.
>
> You use the "kprobes trick", but none of the kprobes code (AFAICS).
> Couldn't there be some common code between the two?

I'm not 100% sure how kprobes work, but I believe they use traps. And then
they set the return address to take another trap, to fix it. I could be
totally off here, on how kprobes does this.

But ftrace is about executing the code directly. The return code jumps to
a another function in asm that will set up the call to do the tracing, and
then fix the return pointer back. The only thing that is similar between
the two approaches that I can tell, is that we both modify the return
address of the function. I took a quick peek at the kprobes code and I
see no easy way to share it.

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/