Re: [RFC PATCH] tracepoint: Provide tracepoint_kernel_find_by_name
From: Alexei Starovoitov
Date: Mon Mar 26 2018 - 16:48:44 EST
On Mon, Mar 26, 2018 at 03:10:31PM -0400, Mathieu Desnoyers wrote:
> Provide an API allowing eBPF to lookup core kernel tracepoints by name.
>
> Given that a lookup by name explicitly requires tracepoint definitions
> to be unique for a given name (no duplicate keys), include a
> WARN_ON_ONCE() check that only a single match is encountered at runtime.
> This should always be the case, given that a DEFINE_TRACE emits a
> __tracepoint_##name symbol, which would cause a link-time error if more
> than one instance is found. Nevertheless, check this at runtime with
> WARN_ON_ONCE() to stay on the safe side.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
> CC: Steven Rostedt <rostedt@xxxxxxxxxxx>
> CC: Alexei Starovoitov <ast@xxxxxxxxxx>
> CC: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> CC: Ingo Molnar <mingo@xxxxxxxxxx>
Mathieu, that's not enough.
Commit log is also wrong.
It needs to state that something like this is needed only because
changing for_each_tracepoint_range() semantics will break lttng.
I'll post a follow up patch shortly.