Re: [PATCH 3/5] ftrace perf: Use ftrace_ops::private to store event pointer
From: Steven Rostedt
Date: Fri Mar 18 2016 - 10:28:53 EST
On Wed, 16 Mar 2016 15:34:31 +0100
Jiri Olsa <jolsa@xxxxxxxxxx> 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@xxxxxxxxxx>
> Suggested-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Acked-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
-- Steve