Re: [RFC PATCH tip 4/5] use BPF in tracing filters

From: Masami Hiramatsu
Date: Fri Dec 06 2013 - 18:49:12 EST


(2013/12/06 19:05), Jovi Zhangwei wrote:
> On Fri, Dec 6, 2013 at 4:43 PM, Masami Hiramatsu
> <masami.hiramatsu.pt@xxxxxxxxxxx> wrote:
>> (2013/12/05 14:11), Alexei Starovoitov wrote:
>>> On Wed, Dec 4, 2013 at 4:05 PM, Masami Hiramatsu
>>> <masami.hiramatsu.pt@xxxxxxxxxxx> wrote:
>>>> (2013/12/04 10:11), Steven Rostedt wrote:
>>>>> On Wed, 04 Dec 2013 09:48:44 +0900
>>>>> Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx> wrote:
>>>>>
>>>>>> fetch functions and actions. In that case, we can continue
>>>>>> to use current interface but much faster to trace.
>>>>>> Also, we can see what filter/arguments/actions are set
>>>>>> on each event.
>>>>>
>>>>> There's also the problem that the current filters work with the results
>>>>> of what is written to the buffer, not what is passed in by the trace
>>>>> point, as that isn't even displayed to the user.
>>>>
>>>> Agreed, so I've said I doubt this implementation is a good
>>>> shape to integrate. Ktap style is better, since it just gets
>>>> parameters from perf buffer entry (using event format).
>>>
>>> Are you saying always store all arguments into ring buffer and let
>>> filter run on it?
>>
>> Yes, it is what ftrace does. I doubt your way fits all of the existing
>> trace-event macros. However, I think just for dynamic events, you can
>> integrating the argument fetching and filtering.
>>
> Does this will affect the user interface of perf-probe argument fetching?
>
> I mean if use bpf backend, do we must need gcc to compile bpf source
> for perf-probe argument fetching? as we known, current argument
> fetching is go through kprobe_events/uprobe_events debugfs file, and
> ktap is based on this behavior.

No, I don't want to do that. Feeding binary code into the kernel is
not trusted nor controllable. I'd just like to see the code which
optimizing current fetching/filtering methods, and that is possible.

Anyway, as far as I can see, there looks be two different models of
tracing in our mind.

A) Fixed event based tracing: In this model, there are several fixed
"events" which well defined with fixed arguments. tracer handles these
events and only use limited arguments. It's like a packet stream
processing. ftrace, perf etc. are used this model.

B) Flexible event-point tracing: In this model, each tracer(or even
trace user) can freely define their own event, there will be some fixed
tracing points defined, but arguments are defined by users. It's like a
debugger's breakpoint debugging. systemtap, ktap etc. are used this model.

Of course, both have pros/cons, and can share some fundamental features.
e.g. B model has a good flexibility and A model is easy to use for beginners.

I think we'd better not integrate these two, but find the better way
to share each functionality.

Thank you,

--
Masami HIRAMATSU
IT Management 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/