[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200226073443.3f6b44422104873dc0397d0e@kernel.org>
Date: Wed, 26 Feb 2020 07:34:43 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: <zhe.he@...driver.com>
Cc: <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
<jolsa@...hat.com>, <namhyung@...nel.org>,
<kstewart@...uxfoundation.org>, <tglx@...utronix.de>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] perf: Fix checking of duplicate probe to give
proper hint
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@...driver.com> wrote:
> From: He Zhe <zhe.he@...driver.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@...uarm64:~# 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@...uarm64:~# 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@...uarm64:~# 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@...uarm64:~# 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@...driver.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@...nel.org>
Powered by blists - more mailing lists