lkml.org 
[lkml]   [2017]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf/ftrace: fix doubled traces of perf on ftrace:function
On Fri, 25 Aug 2017 21:49:37 +0800
Zhou Chengming <zhouchengming1@huawei.com> wrote:

> When run perf on the ftrace:function tracepoint, there is a bug
> which can be reproduced by:
>
> perf record -e ftrace:function -a sleep 20 &
> perf record -e ftrace:function ls
> perf script
>
> ls 10304 [005] 171.853235: ftrace:function:
> perf_output_begin
> ls 10304 [005] 171.853237: ftrace:function:
> perf_output_begin
> ls 10304 [005] 171.853239: ftrace:function:
> task_tgid_nr_ns
> ls 10304 [005] 171.853240: ftrace:function:
> task_tgid_nr_ns
> ls 10304 [005] 171.853242: ftrace:function:
> __task_pid_nr_ns
> ls 10304 [005] 171.853244: ftrace:function:
> __task_pid_nr_ns
>
> We can see that all the function traces are doubled in perf.data
> of "ls".
>
> The problem is caused by the inconsistency of the register
> function perf_ftrace_event_register() with the probe function
> perf_ftrace_function_call(). The former registers one probe
> for every perf_event. And the latter handles all perf_events
> on the current cpu. So when two perf_events on the current cpu,
> the traces of them will be doubled.
>
> So this patch adds an extra parameter "event" for perf_tp_event,
> only send sample data to this event when it's not NULL.
>
> Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
> ---
> include/linux/perf_event.h | 2 +-
> include/linux/trace_events.h | 4 ++--
> kernel/events/core.c | 13 +++++++++----
> kernel/trace/trace_event_perf.c | 4 +++-
> kernel/trace/trace_kprobe.c | 4 ++--
> kernel/trace/trace_syscalls.c | 4 ++--
> kernel/trace/trace_uprobe.c | 2 +-

The trace files look fine to me.

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

-- Steve

> 7 files changed, 20 insertions(+), 13 deletions(-)
>

\
 
 \ /
  Last update: 2017-08-25 15:58    [W:0.046 / U:2.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site