From: Masami Hiramatsu <mhiramat@kernel.org>
To: <zhe.he@windriver.com>
Cc: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
<jolsa@redhat.com>, <namhyung@kernel.org>,
<kstewart@linuxfoundation.org>, <tglx@linutronix.de>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] perf: Fix checking of duplicate probe to give proper hint
Date: Wed, 26 Feb 2020 07:34:43 +0900 [thread overview]
Message-ID: <20200226073443.3f6b44422104873dc0397d0e@kernel.org> (raw)
In-Reply-To: <1582641703-233485-1-git-send-email-zhe.he@windriver.com>
Hi,
Thanks for reporting. This bug has been reported and I should fixed last year...
https://lkml.org/lkml/2019/12/3/136
Arnaldo, haven't you picked it yet?
Thank you,
On Tue, 25 Feb 2020 22:41:42 +0800
<zhe.he@windriver.com> wrote:
> From: He Zhe <zhe.he@windriver.com>
>
> Since commit 72363540c009 ("perf probe: Support multiprobe event") and its
> series, if there are multiple probes for one event,
> __probe_file__get_namelist would return -EEXIST and cause the following
> failure without proper hint, due to adding existing entry to output list.
>
> root@qemuarm64:~# perf probe -x /lib64/libc.so.6 free
> Added new events:
> probe_libc:free (on free in /lib64/libc-2.31.so)
> probe_libc:free (on free in /lib64/libc-2.31.so)
>
> You can now use it in all perf tools, such as:
>
> perf record -e probe_libc:free -aR sleep 1
>
> root@qemuarm64:~# perf probe -l
> probe_libc:free (on free@plt in /lib64/libc-2.31.so)
> probe_libc:free (on cfree in /lib64/libc-2.31.so)
> root@qemuarm64:~# perf probe -x /lib64/libc.so.6 free
> Error: Failed to add events.
>
> As we just want to check if there is any probe with the same name, -EEXIST
> can be ignored, so we can have the right hint as before.
>
> root@qemuarm64:~# perf probe -x /lib64/libc.so.6 free
> Error: event "free" already exists.
> Hint: Remove existing event by 'perf probe -d'
> or force duplicates by 'perf probe -f'
> or set 'force=yes' in BPF source.
> Error: Failed to add events.
>
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
> tools/perf/util/probe-file.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
> index 5003ba403345..cf44c05f89c1 100644
> --- a/tools/perf/util/probe-file.c
> +++ b/tools/perf/util/probe-file.c
> @@ -201,10 +201,16 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group)
> if (include_group) {
> ret = e_snprintf(buf, 128, "%s:%s", tev.group,
> tev.event);
> - if (ret >= 0)
> + if (ret >= 0) {
> ret = strlist__add(sl, buf);
> - } else
> + if (ret == -EEXIST)
> + ret = 0;
> + }
> + } else {
> ret = strlist__add(sl, tev.event);
> + if (ret == -EEXIST)
> + ret = 0;
> + }
> clear_probe_trace_event(&tev);
> if (ret < 0)
> break;
> --
> 2.24.1
>
--
Masami Hiramatsu <mhiramat@kernel.org>
prev parent reply other threads:[~2020-02-25 22:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 14:41 [PATCH 1/2] perf: Fix checking of duplicate probe to give proper hint zhe.he
2020-02-25 14:41 ` [PATCH 2/2] perf: probe-file: Check return value of strlist__add zhe.he
2020-02-25 22:49 ` Masami Hiramatsu
2020-02-26 2:49 ` He Zhe
2020-02-26 7:11 ` Masami Hiramatsu
2020-02-25 22:34 ` Masami Hiramatsu [this message]
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=20200226073443.3f6b44422104873dc0397d0e@kernel.org \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=zhe.he@windriver.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