Re: [PATCH 0/5][RFC] kprobes/ftrace: Have kprobes use ftrace on ftracenops

From: Masami Hiramatsu
Date: Wed Aug 17 2011 - 08:13:02 EST


(2011/08/15 22:06), Steven Rostedt wrote:
> On Sun, 2011-08-14 at 19:28 +0900, Masami Hiramatsu wrote:
>
>>> The point I was making is, if I need to get ftrace function tracing
>>> being good enough for function graph tracer, then it should work with
>>> kprobes without any issues.
>>
>> No, I don't think so, because kprobes user may trace a flags register or
>> segment registers. However, function graph tracer only needs stack
>> register etc. Thus, if ftrace function tracing is good enough for
>> kprobes handlers, it is enough for function graph tracer too.
>
> The added code needed for ftrace is not much more. We just need to save
> all of pt_regs and that should work (I already save most of it). The
> flags can be saved, but things like compare flags will be useless, as
> those are used. But compare flags are undefined when calling a function
> anyway.

Agreed. I think users may just want to see other status flags.

>>> If I need to do the work anyway (for
>>> function graph tracing) then why not use it directly with kprobes
>>> instead of doing more hooks just in the kprobe_trace?
>>
>> >From the kprobe-tracer point of view, I don't mind. I just care
>> about complexity, and compatibility of kprobe handlers.
>
> Right, so far there's not much changes to the kprobe side. I'll see if I
> can make ftrace do all the hard work to get the proper registers. I want
> to make as much as possible stay in the generic kprobe code, and not
> touch the arch code. But I may still need to do something like
> 'increment rip' or whatever.

kprobes arch side code is not so complex, it has less states.
Generic kprobes code has much more states to support module
probes, module init, aggregated probes, and so on. So it is OK for me
to touch the arch code :).

> Note, we will need to touch kprobes one way or another. Either we have
> kprobes hook to ftrace, or we need to do the nop skip trick, which will
> probably be as intrusive in the kprobe code.

I see. OK, I'm now looking forward to your work ;)

Thank you!


--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@xxxxxxxxxxx
--
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/