linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf probe: Fix to delete multiple probe event
@ 2019-12-03  8:01 Masami Hiramatsu
  2019-12-04  2:29 ` Masami Hiramatsu
  0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2019-12-03  8:01 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Masami Hiramatsu, Adrian Hunter, Jiri Olsa, Namhyung Kim,
	Linux Kernel Mailing List

Fix to delete multiple probe event with filter correctly.

When we put an event with multiple probes, perf-probe fails
to delete with filters. This comes from a failure to list
up the event name because of overwrapping its name.

To fix this issue, skip to list up the event which has
same name.

Without this patch:
  # perf probe -l \*
    probe_perf:map__map_ip (on perf_sample__fprintf_brstackoff:21@
    probe_perf:map__map_ip (on perf_sample__fprintf_brstackoff:25@
    probe_perf:map__map_ip (on append_inlines:12@util/machine.c in
    probe_perf:map__map_ip (on unwind_entry:19@util/machine.c in /
    probe_perf:map__map_ip (on map__map_ip@util/map.h in /home/mhi
    probe_perf:map__map_ip (on map__map_ip@util/map.h in /home/mhi
  # perf probe -d \*
  "*" does not hit any event.
    Error: Failed to delete events. Reason: No such file or directory (Code: -2)

With this:
  # perf probe -d \*
  Removed event: probe_perf:map__map_ip

Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 tools/perf/util/probe-file.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 5003ba403345..c03a591d41a4 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -206,6 +206,9 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group)
 		} else
 			ret = strlist__add(sl, tev.event);
 		clear_probe_trace_event(&tev);
+		/* Skip if there is same name multi-probe event in the list */
+		if (ret == -EEXIST)
+			ret = 0;
 		if (ret < 0)
 			break;
 	}


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

* Re: [PATCH] perf probe: Fix to delete multiple probe event
  2019-12-03  8:01 [PATCH] perf probe: Fix to delete multiple probe event Masami Hiramatsu
@ 2019-12-04  2:29 ` Masami Hiramatsu
  2020-01-08  2:36   ` Masami Hiramatsu
  0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2019-12-04  2:29 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Masami Hiramatsu, Adrian Hunter, Jiri Olsa, Namhyung Kim,
	Linux Kernel Mailing List

On Tue,  3 Dec 2019 17:01:54 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Fix to delete multiple probe event with filter correctly.
> 
> When we put an event with multiple probes, perf-probe fails
> to delete with filters. This comes from a failure to list
> up the event name because of overwrapping its name.
> 
> To fix this issue, skip to list up the event which has
> same name.
> 
> Without this patch:
>   # perf probe -l \*
>     probe_perf:map__map_ip (on perf_sample__fprintf_brstackoff:21@
>     probe_perf:map__map_ip (on perf_sample__fprintf_brstackoff:25@
>     probe_perf:map__map_ip (on append_inlines:12@util/machine.c in
>     probe_perf:map__map_ip (on unwind_entry:19@util/machine.c in /
>     probe_perf:map__map_ip (on map__map_ip@util/map.h in /home/mhi
>     probe_perf:map__map_ip (on map__map_ip@util/map.h in /home/mhi
>   # perf probe -d \*
>   "*" does not hit any event.
>     Error: Failed to delete events. Reason: No such file or directory (Code: -2)
> 
> With this:
>   # perf probe -d \*
>   Removed event: probe_perf:map__map_ip
> 

Oops, I missed Fixed tag.

Fixes: 72363540c009 ("perf probe: Support multiprobe event")

Thanks,

> Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  tools/perf/util/probe-file.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
> index 5003ba403345..c03a591d41a4 100644
> --- a/tools/perf/util/probe-file.c
> +++ b/tools/perf/util/probe-file.c
> @@ -206,6 +206,9 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group)
>  		} else
>  			ret = strlist__add(sl, tev.event);
>  		clear_probe_trace_event(&tev);
> +		/* Skip if there is same name multi-probe event in the list */
> +		if (ret == -EEXIST)
> +			ret = 0;
>  		if (ret < 0)
>  			break;
>  	}
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: [PATCH] perf probe: Fix to delete multiple probe event
  2019-12-04  2:29 ` Masami Hiramatsu
@ 2020-01-08  2:36   ` Masami Hiramatsu
  2020-01-08  5:53     ` Sandipan Das
  0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2020-01-08  2:36 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Ravi Bangoria, Sandipan Das, linux-perf-users, Naveen N. Rao,
	Arnaldo Carvalho de Melo, Adrian Hunter, Jiri Olsa, Namhyung Kim,
	Linux Kernel Mailing List

Hi Arnaldo,

Could you pick this fix?

Sandipan, could you also test this?

Thank you,

On Wed, 4 Dec 2019 11:29:52 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> On Tue,  3 Dec 2019 17:01:54 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > Fix to delete multiple probe event with filter correctly.
> > 
> > When we put an event with multiple probes, perf-probe fails
> > to delete with filters. This comes from a failure to list
> > up the event name because of overwrapping its name.
> > 
> > To fix this issue, skip to list up the event which has
> > same name.
> > 
> > Without this patch:
> >   # perf probe -l \*
> >     probe_perf:map__map_ip (on perf_sample__fprintf_brstackoff:21@
> >     probe_perf:map__map_ip (on perf_sample__fprintf_brstackoff:25@
> >     probe_perf:map__map_ip (on append_inlines:12@util/machine.c in
> >     probe_perf:map__map_ip (on unwind_entry:19@util/machine.c in /
> >     probe_perf:map__map_ip (on map__map_ip@util/map.h in /home/mhi
> >     probe_perf:map__map_ip (on map__map_ip@util/map.h in /home/mhi
> >   # perf probe -d \*
> >   "*" does not hit any event.
> >     Error: Failed to delete events. Reason: No such file or directory (Code: -2)
> > 
> > With this:
> >   # perf probe -d \*
> >   Removed event: probe_perf:map__map_ip
> > 
> 
> Oops, I missed Fixed tag.
> 
> Fixes: 72363540c009 ("perf probe: Support multiprobe event")
> 
> Thanks,	
> 
> > Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  tools/perf/util/probe-file.c |    3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
> > index 5003ba403345..c03a591d41a4 100644
> > --- a/tools/perf/util/probe-file.c
> > +++ b/tools/perf/util/probe-file.c
> > @@ -206,6 +206,9 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group)
> >  		} else
> >  			ret = strlist__add(sl, tev.event);
> >  		clear_probe_trace_event(&tev);
> > +		/* Skip if there is same name multi-probe event in the list */
> > +		if (ret == -EEXIST)
> > +			ret = 0;
> >  		if (ret < 0)
> >  			break;
> >  	}
> > 
> 
> 
> -- 
> Masami Hiramatsu <mhiramat@kernel.org>


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: [PATCH] perf probe: Fix to delete multiple probe event
  2020-01-08  2:36   ` Masami Hiramatsu
@ 2020-01-08  5:53     ` Sandipan Das
  0 siblings, 0 replies; 4+ messages in thread
From: Sandipan Das @ 2020-01-08  5:53 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Ravi Bangoria, linux-perf-users, Naveen N. Rao,
	Arnaldo Carvalho de Melo, Adrian Hunter, Jiri Olsa, Namhyung Kim,
	Linux Kernel Mailing List


On 08/01/20 8:06 am, Masami Hiramatsu wrote:
> Hi Arnaldo,
> 
> Could you pick this fix?
> 
> Sandipan, could you also test this?
> 
[...]

Thanks for fixing this.

Tested-by: Sandipan Das <sandipan@linux.ibm.com>


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

end of thread, other threads:[~2020-01-08  5:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03  8:01 [PATCH] perf probe: Fix to delete multiple probe event Masami Hiramatsu
2019-12-04  2:29 ` Masami Hiramatsu
2020-01-08  2:36   ` Masami Hiramatsu
2020-01-08  5:53     ` Sandipan Das

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