Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1720088

Re: [PATCH] perf/ftrace: fix doubled traces of perf on ftrace:function

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [PATCH] perf/ftrace: fix doubled traces of perf on ftrace:function
Date 2017-08-25 16:00 +0200
Message-ID <uinjr-4Jl-11@gated-at.bofh.it> (permalink)
References <uin9M-4Gg-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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(-)
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] perf/ftrace: fix doubled traces of perf on ftrace:function Zhou Chengming <zhouchengming1@huawei.com> - 2017-08-25 15:50 +0200
  Re: [PATCH] perf/ftrace: fix doubled traces of perf on  ftrace:function Steven Rostedt <rostedt@goodmis.org> - 2017-08-25 16:00 +0200
  Re: [PATCH] perf/ftrace: fix doubled traces of perf on  ftrace:function Jiri Olsa <jolsa@redhat.com> - 2017-08-28 13:10 +0200
  [tip:perf/urgent] perf/ftrace: Fix double traces of perf on  ftrace:function tip-bot for Zhou Chengming <tipbot@zytor.com> - 2017-08-29 15:20 +0200

csiph-web