linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf-probe: Accept the instance number of kretprobe event
@ 2020-05-06 14:29 Masami Hiramatsu
  2020-05-06 16:17 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2020-05-06 14:29 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Namhyung Kim, Masami Hiramatsu, linux-kernel

Since the commit 6a13a0d7b4d1 ("ftrace/kprobe: Show the
maxactive number on kprobe_events") introduced to show the
instance number of kretprobe events, the length of the 1st
format of the kprobe event will not 1, but it can be longer.
This caused a parser error in perf-probe.

Skip the length check the 1st format of the kprobe event
to accept this instance number.

Without this fix:

  # perf probe -a vfs_read%return
  Added new event:
    probe:vfs_read__return (on vfs_read%return)

  You can now use it in all perf tools, such as:

  	perf record -e probe:vfs_read__return -aR sleep 1

  # perf probe -l
  Semantic error :Failed to parse event name: r16:probe/vfs_read__return
    Error: Failed to show event list.

And with this fixes:

  # perf probe -a vfs_read%return
  ...
  # perf probe -l
    probe:vfs_read__return (on vfs_read%return)


Fixes: 6a13a0d7b4d1 ("ftrace/kprobe: Show the maxactive number on kprobe_events")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: stable@vger.kernel.org
Link: https://bugzilla.kernel.org/show_bug.cgi?id=207587
---
 tools/perf/util/probe-event.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index eea132f512b0..c6bcf5709564 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1765,8 +1765,7 @@ int parse_probe_trace_command(const char *cmd, struct probe_trace_event *tev)
 	fmt1_str = strtok_r(argv0_str, ":", &fmt);
 	fmt2_str = strtok_r(NULL, "/", &fmt);
 	fmt3_str = strtok_r(NULL, " \t", &fmt);
-	if (fmt1_str == NULL || strlen(fmt1_str) != 1 || fmt2_str == NULL
-	    || fmt3_str == NULL) {
+	if (fmt1_str == NULL || fmt2_str == NULL || fmt3_str == NULL) {
 		semantic_error("Failed to parse event name: %s\n", argv[0]);
 		ret = -EINVAL;
 		goto out;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf-probe: Accept the instance number of kretprobe event
  2020-05-06 14:29 [PATCH] perf-probe: Accept the instance number of kretprobe event Masami Hiramatsu
@ 2020-05-06 16:17 ` Arnaldo Carvalho de Melo
  2020-05-06 16:41   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-05-06 16:17 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: yshuiv7, Jiri Olsa, Namhyung Kim, linux-kernel

Em Wed, May 06, 2020 at 11:29:12PM +0900, Masami Hiramatsu escreveu:
> Since the commit 6a13a0d7b4d1 ("ftrace/kprobe: Show the
> maxactive number on kprobe_events") introduced to show the
> instance number of kretprobe events, the length of the 1st
> format of the kprobe event will not 1, but it can be longer.
> This caused a parser error in perf-probe.

Thanks for the quick fix!

I'll add this right after the Fixes tag:

Reported-by: yshuiv7@gmail.com
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207587

Ok?

yshuiv, can I have your name to add to that Reported-by tag? And if you
test it, please, I can add a Tested-by: tag as well, credits where
credits are due!

Thanks!

- Arnaldo
 
> Skip the length check the 1st format of the kprobe event
> to accept this instance number.
> 
> Without this fix:
> 
>   # perf probe -a vfs_read%return
>   Added new event:
>     probe:vfs_read__return (on vfs_read%return)
> 
>   You can now use it in all perf tools, such as:
> 
>   	perf record -e probe:vfs_read__return -aR sleep 1
> 
>   # perf probe -l
>   Semantic error :Failed to parse event name: r16:probe/vfs_read__return
>     Error: Failed to show event list.
> 
> And with this fixes:
> 
>   # perf probe -a vfs_read%return
>   ...
>   # perf probe -l
>     probe:vfs_read__return (on vfs_read%return)
> 
> 
> Fixes: 6a13a0d7b4d1 ("ftrace/kprobe: Show the maxactive number on kprobe_events")
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: stable@vger.kernel.org
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=207587
> ---
>  tools/perf/util/probe-event.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index eea132f512b0..c6bcf5709564 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -1765,8 +1765,7 @@ int parse_probe_trace_command(const char *cmd, struct probe_trace_event *tev)
>  	fmt1_str = strtok_r(argv0_str, ":", &fmt);
>  	fmt2_str = strtok_r(NULL, "/", &fmt);
>  	fmt3_str = strtok_r(NULL, " \t", &fmt);
> -	if (fmt1_str == NULL || strlen(fmt1_str) != 1 || fmt2_str == NULL
> -	    || fmt3_str == NULL) {
> +	if (fmt1_str == NULL || fmt2_str == NULL || fmt3_str == NULL) {
>  		semantic_error("Failed to parse event name: %s\n", argv[0]);
>  		ret = -EINVAL;
>  		goto out;
> 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf-probe: Accept the instance number of kretprobe event
  2020-05-06 16:17 ` Arnaldo Carvalho de Melo
@ 2020-05-06 16:41   ` Arnaldo Carvalho de Melo
  2020-05-07  8:44     ` Masami Hiramatsu
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-05-06 16:41 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: yshuiv7, Jiri Olsa, Namhyung Kim, linux-kernel

Em Wed, May 06, 2020 at 01:17:23PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, May 06, 2020 at 11:29:12PM +0900, Masami Hiramatsu escreveu:
> > Since the commit 6a13a0d7b4d1 ("ftrace/kprobe: Show the
> > maxactive number on kprobe_events") introduced to show the
> > instance number of kretprobe events, the length of the 1st
> > format of the kprobe event will not 1, but it can be longer.
> > This caused a parser error in perf-probe.
> 
> Thanks for the quick fix!
> 
> I'll add this right after the Fixes tag:
> 
> Reported-by: yshuiv7@gmail.com
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207587

Sorry, I didn't notice you added it as a Link: :-)

> Ok?
> 
> yshuiv, can I have your name to add to that Reported-by tag? And if you
> test it, please, I can add a Tested-by: tag as well, credits where
> credits are due!
> 
> Thanks!
> 
> - Arnaldo
>  
> > Skip the length check the 1st format of the kprobe event
> > to accept this instance number.
> > 
> > Without this fix:
> > 
> >   # perf probe -a vfs_read%return
> >   Added new event:
> >     probe:vfs_read__return (on vfs_read%return)
> > 
> >   You can now use it in all perf tools, such as:
> > 
> >   	perf record -e probe:vfs_read__return -aR sleep 1
> > 
> >   # perf probe -l
> >   Semantic error :Failed to parse event name: r16:probe/vfs_read__return
> >     Error: Failed to show event list.
> > 
> > And with this fixes:
> > 
> >   # perf probe -a vfs_read%return
> >   ...
> >   # perf probe -l
> >     probe:vfs_read__return (on vfs_read%return)
> > 
> > 
> > Fixes: 6a13a0d7b4d1 ("ftrace/kprobe: Show the maxactive number on kprobe_events")
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > Cc: stable@vger.kernel.org
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=207587
> > ---
> >  tools/perf/util/probe-event.c |    3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > index eea132f512b0..c6bcf5709564 100644
> > --- a/tools/perf/util/probe-event.c
> > +++ b/tools/perf/util/probe-event.c
> > @@ -1765,8 +1765,7 @@ int parse_probe_trace_command(const char *cmd, struct probe_trace_event *tev)
> >  	fmt1_str = strtok_r(argv0_str, ":", &fmt);
> >  	fmt2_str = strtok_r(NULL, "/", &fmt);
> >  	fmt3_str = strtok_r(NULL, " \t", &fmt);
> > -	if (fmt1_str == NULL || strlen(fmt1_str) != 1 || fmt2_str == NULL
> > -	    || fmt3_str == NULL) {
> > +	if (fmt1_str == NULL || fmt2_str == NULL || fmt3_str == NULL) {
> >  		semantic_error("Failed to parse event name: %s\n", argv[0]);
> >  		ret = -EINVAL;
> >  		goto out;
> > 
> 
> -- 
> 
> - Arnaldo

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf-probe: Accept the instance number of kretprobe event
  2020-05-06 16:41   ` Arnaldo Carvalho de Melo
@ 2020-05-07  8:44     ` Masami Hiramatsu
  0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2020-05-07  8:44 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: yshuiv7, Jiri Olsa, Namhyung Kim, linux-kernel

On Wed, 6 May 2020 13:41:31 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Em Wed, May 06, 2020 at 01:17:23PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Wed, May 06, 2020 at 11:29:12PM +0900, Masami Hiramatsu escreveu:
> > > Since the commit 6a13a0d7b4d1 ("ftrace/kprobe: Show the
> > > maxactive number on kprobe_events") introduced to show the
> > > instance number of kretprobe events, the length of the 1st
> > > format of the kprobe event will not 1, but it can be longer.
> > > This caused a parser error in perf-probe.
> > 
> > Thanks for the quick fix!
> > 
> > I'll add this right after the Fixes tag:
> > 
> > Reported-by: yshuiv7@gmail.com
> > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207587
> 
> Sorry, I didn't notice you added it as a Link: :-)
> 
> > Ok?

Yes, I missed the yshuiv's mail so missed it. please add it :)

Thank you,

> > 
> > yshuiv, can I have your name to add to that Reported-by tag? And if you
> > test it, please, I can add a Tested-by: tag as well, credits where
> > credits are due!
> > 
> > Thanks!
> > 
> > - Arnaldo
> >  
> > > Skip the length check the 1st format of the kprobe event
> > > to accept this instance number.
> > > 
> > > Without this fix:
> > > 
> > >   # perf probe -a vfs_read%return
> > >   Added new event:
> > >     probe:vfs_read__return (on vfs_read%return)
> > > 
> > >   You can now use it in all perf tools, such as:
> > > 
> > >   	perf record -e probe:vfs_read__return -aR sleep 1
> > > 
> > >   # perf probe -l
> > >   Semantic error :Failed to parse event name: r16:probe/vfs_read__return
> > >     Error: Failed to show event list.
> > > 
> > > And with this fixes:
> > > 
> > >   # perf probe -a vfs_read%return
> > >   ...
> > >   # perf probe -l
> > >     probe:vfs_read__return (on vfs_read%return)
> > > 
> > > 
> > > Fixes: 6a13a0d7b4d1 ("ftrace/kprobe: Show the maxactive number on kprobe_events")
> > > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > > Cc: stable@vger.kernel.org
> > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=207587
> > > ---
> > >  tools/perf/util/probe-event.c |    3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > > index eea132f512b0..c6bcf5709564 100644
> > > --- a/tools/perf/util/probe-event.c
> > > +++ b/tools/perf/util/probe-event.c
> > > @@ -1765,8 +1765,7 @@ int parse_probe_trace_command(const char *cmd, struct probe_trace_event *tev)
> > >  	fmt1_str = strtok_r(argv0_str, ":", &fmt);
> > >  	fmt2_str = strtok_r(NULL, "/", &fmt);
> > >  	fmt3_str = strtok_r(NULL, " \t", &fmt);
> > > -	if (fmt1_str == NULL || strlen(fmt1_str) != 1 || fmt2_str == NULL
> > > -	    || fmt3_str == NULL) {
> > > +	if (fmt1_str == NULL || fmt2_str == NULL || fmt3_str == NULL) {
> > >  		semantic_error("Failed to parse event name: %s\n", argv[0]);
> > >  		ret = -EINVAL;
> > >  		goto out;
> > > 
> > 
> > -- 
> > 
> > - Arnaldo
> 
> -- 
> 
> - Arnaldo


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-07  8:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 14:29 [PATCH] perf-probe: Accept the instance number of kretprobe event Masami Hiramatsu
2020-05-06 16:17 ` Arnaldo Carvalho de Melo
2020-05-06 16:41   ` Arnaldo Carvalho de Melo
2020-05-07  8:44     ` Masami Hiramatsu

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