Re: [PATCH 3/5] ftrace perf: Use ftrace_ops::private to store event pointer

Steven Rostedt
2016-03-18T14:28:51Z

On Wed, 16 Mar 2016 15:34:31 +0100
Jiri Olsa <jolsa@kernel.org> wrote:

> Having following commands running concurrently:
>
> # perf record -e ftrace:function -a -o krava.data sleep 10
> # perf record -e ftrace:function --filter 'ip == SyS_read' ls
>
> will end up in the latter one to fail on the filter rules
> and store all functions (in perf.data) as instructed by the
> first perf record instead of just SyS_read records.
>
> The reason for this is, that tracepoint code by default
> triggers all events that registered for the tracepoint.
>
> While ftrace:function is special because ftrace_ops
> itself carries a filter and only the event that owns
> ftrace_ops is eligible to be triggered.
>
> Fixing this by using ftrace_ops::private value to keep
> the perf_event pointer. This way we don't need to search
> for triggered event (as tracepoint handler does) and
> directly store sample.
>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
> Suggested-by: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve