linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set
@ 2020-08-18 12:30 Tiezhu Yang
  2020-08-18 12:44 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2020-08-18 12:30 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim
  Cc: linux-kernel, Xuefeng Li

When I execute perf top without HAVE_LIBBPF_SUPPORT, there exists the
following segmentation fault, skip the side-band event setup to fix it,
this is similar with commit 1101c872c8c7 ("perf record: Skip side-band
event setup if HAVE_LIBBPF_SUPPORT is not set").

[yangtiezhu@linux perf]$ ./perf top

<SNIP>
perf: Segmentation fault
Obtained 6 stack frames.
./perf(sighandler_dump_stack+0x5c) [0x12011b604]
[0xffffffc010]
./perf(perf_mmap__read_init+0x3e) [0x1201feeae]
./perf() [0x1200d715c]
/lib64/libpthread.so.0(+0xab9c) [0xffee10ab9c]
/lib64/libc.so.6(+0x128f4c) [0xffedc08f4c]
Segmentation fault

I use git bisect to find commit b38d85ef49cf ("perf bpf: Decouple
creating the evlist from adding the SB event") is the first bad
commit, so also add the Fixes tag.

Fixes: b38d85ef49cf ("perf bpf: Decouple creating the evlist from adding the SB event")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 tools/perf/builtin-top.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 994c230..7c64134 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1746,6 +1746,7 @@ int cmd_top(int argc, const char **argv)
 		goto out_delete_evlist;
 	}
 
+#ifdef HAVE_LIBBPF_SUPPORT
 	if (!top.record_opts.no_bpf_event) {
 		top.sb_evlist = evlist__new();
 
@@ -1759,6 +1760,7 @@ int cmd_top(int argc, const char **argv)
 			goto out_delete_evlist;
 		}
 	}
+#endif
 
 	if (perf_evlist__start_sb_thread(top.sb_evlist, target)) {
 		pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");
-- 
2.1.0


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

* Re: [PATCH] perf top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set
  2020-08-18 12:30 [PATCH] perf top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set Tiezhu Yang
@ 2020-08-18 12:44 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-08-18 12:44 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Ingo Molnar, Peter Zijlstra, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-kernel, Xuefeng Li

Em Tue, Aug 18, 2020 at 08:30:37PM +0800, Tiezhu Yang escreveu:
> When I execute perf top without HAVE_LIBBPF_SUPPORT, there exists the
> following segmentation fault, skip the side-band event setup to fix it,
> this is similar with commit 1101c872c8c7 ("perf record: Skip side-band
> event setup if HAVE_LIBBPF_SUPPORT is not set").
> 
> [yangtiezhu@linux perf]$ ./perf top
> 
> <SNIP>
> perf: Segmentation fault
> Obtained 6 stack frames.
> ./perf(sighandler_dump_stack+0x5c) [0x12011b604]
> [0xffffffc010]
> ./perf(perf_mmap__read_init+0x3e) [0x1201feeae]
> ./perf() [0x1200d715c]
> /lib64/libpthread.so.0(+0xab9c) [0xffee10ab9c]
> /lib64/libc.so.6(+0x128f4c) [0xffedc08f4c]
> Segmentation fault
> 
> I use git bisect to find commit b38d85ef49cf ("perf bpf: Decouple
> creating the evlist from adding the SB event") is the first bad
> commit, so also add the Fixes tag.
> 
> Fixes: b38d85ef49cf ("perf bpf: Decouple creating the evlist from adding the SB event")
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>

Yeah, thanks, applying.

- Arnaldo

> ---
>  tools/perf/builtin-top.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 994c230..7c64134 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -1746,6 +1746,7 @@ int cmd_top(int argc, const char **argv)
>  		goto out_delete_evlist;
>  	}
>  
> +#ifdef HAVE_LIBBPF_SUPPORT
>  	if (!top.record_opts.no_bpf_event) {
>  		top.sb_evlist = evlist__new();
>  
> @@ -1759,6 +1760,7 @@ int cmd_top(int argc, const char **argv)
>  			goto out_delete_evlist;
>  		}
>  	}
> +#endif
>  
>  	if (perf_evlist__start_sb_thread(top.sb_evlist, target)) {
>  		pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");
> -- 
> 2.1.0
> 

-- 

- Arnaldo

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

end of thread, other threads:[~2020-08-18 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 12:30 [PATCH] perf top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set Tiezhu Yang
2020-08-18 12:44 ` Arnaldo Carvalho de Melo

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