[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170825095644.5d310469@gandalf.local.home>
Date: Fri, 25 Aug 2017 09:56:44 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Zhou Chengming <zhouchengming1@...wei.com>
Cc: <peterz@...radead.org>, <mingo@...hat.com>,
<alexander.shishkin@...ux.intel.com>, <acme@...nel.org>,
<jolsa@...nel.org>, <linux-kernel@...r.kernel.org>,
<huawei.libin@...wei.com>
Subject: Re: [PATCH] perf/ftrace: fix doubled traces of perf on
ftrace:function
On Fri, 25 Aug 2017 21:49:37 +0800
Zhou Chengming <zhouchengming1@...wei.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@...wei.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@...dmis.org>
-- Steve
> 7 files changed, 20 insertions(+), 13 deletions(-)
>
Powered by blists - more mailing lists