From: Steven Rostedt <rostedt@goodmis.org>
To: Zhou Chengming <zhouchengming1@huawei.com>
Cc: <peterz@infradead.org>, <mingo@redhat.com>,
<alexander.shishkin@linux.intel.com>, <acme@kernel.org>,
<jolsa@kernel.org>, <linux-kernel@vger.kernel.org>,
<huawei.libin@huawei.com>
Subject: Re: [PATCH] perf/ftrace: fix doubled traces of perf on ftrace:function
Date: Fri, 25 Aug 2017 09:56:44 -0400 [thread overview]
Message-ID: <20170825095644.5d310469@gandalf.local.home> (raw)
In-Reply-To: <1503668977-12526-1-git-send-email-zhouchengming1@huawei.com>
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(-)
>
next prev parent reply other threads:[~2017-08-25 13:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-25 13:49 [PATCH] perf/ftrace: fix doubled traces of perf on ftrace:function Zhou Chengming
2017-08-25 13:56 ` Steven Rostedt [this message]
2017-08-28 11:07 ` Jiri Olsa
2017-08-29 13:06 ` [tip:perf/urgent] perf/ftrace: Fix double " tip-bot for Zhou Chengming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170825095644.5d310469@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=huawei.libin@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=zhouchengming1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).