perf report: Fix a bug on "--call-graph none" option
Namhyung Kim
maintainerPATCH 1/1 perf report: Fix a bug on "--call-graph none" option
The patch f9db0d0f1b2c ("perf callchain: Allow disabling call graphs per event") added an ability to enable/disable callchain recording per event. But it had a problem when the enablement setting is changed at 'perf report' time using -g/--call-graph option.
For example, the following scenario will get a segfault.
$ perf record -ag sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.500 MB perf.data (2555 samples) ]
$ perf report -g none perf: Segmentation fault -------- backtrace -------- perf[0x53a98a] /usr/lib/libc.so.6(+0x335af)[0x7f4e91df95af]
This is because callchain_param.sort() callback was not set but it tried to call the function as it had the PERF_SAMPLE_CALLCHAIN bit.
--- tools/perf/util/hist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/hist.c +1 -1
@@ -1149,7 +1149,7 @@ void hists__output_resort(struct hists *hists, struct ui_progress *prog)struct perf_evsel *evsel =hists_to_evsel (hists);bool use_callchain; -if (evsel && !symbol_conf.show_ref_callgraph) +if (evsel && symbol_conf.use_callchain && !symbol_conf.show_ref_callgraph) use_callchain = evsel->attr.sample_type &PERF_SAMPLE_CALLCHAIN ;else use_callchain = symbol_conf.use_callchain;
Signature · 1 line
2.5.0
Arnaldo Carvalho de Melo
maintainerEm Wed, Sep 30, 2015 at 01:34:00PM +0900, Namhyung Kim escreveu:
Quoted 11 lines
The patch
f9db0d0f1b2c("perf callchain: Allow disabling call graphs per event") added an ability to enable/disable callchain recording per event. But it had a problem when the enablement setting is changed at 'perf report' time using -g/--call-graph option.For example, the following scenario will get a segfault.
$ perf record -ag sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.500 MB perf.data (2555 samples) ]
Quoted 8 lines
$ perf report -g none perf: Segmentation fault -------- backtrace -------- perf[0x53a98a] /usr/lib/libc.so.6(+0x335af)[0x7f4e91df95af]This is because
callchain_param.sort()callback was not set but it tried to call the function as it had thePERF_SAMPLE_CALLCHAINbit.
Thanks, reproduced, tested the fix, applied.
- Arnaldo
tip-bot for Namhyung Kim
merge botperf report: Fix a bug on "--call-graph none" option
Commit-ID: 208e7607459477432d3df52c32d4b961a96d4a94 Gitweb: http://git.kernel.org/tip/208e7607459477432d3df52c32d4b961a96d4a94 Author: Namhyung Kim <[email protected]> AuthorDate: Wed, 30 Sep 2015 13:34:00 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 1 Oct 2015 09:54:33 -0300
perf report: Fix a bug on "--call-graph none" option
The patch f9db0d0f1b2c ("perf callchain: Allow disabling call graphs per event") added an ability to enable/disable callchain recording per event. But it had a problem when the enablement setting is changed at 'perf report' time using -g/--call-graph option.
For example, the following scenario will get a segfault.
$ perf record -ag sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.500 MB perf.data (2555 samples) ]
$ perf report -g none perf: Segmentation fault -------- backtrace -------- perf[0x53a98a] /usr/lib/libc.so.6(+0x335af)[0x7f4e91df95af]
This is because callchain_param.sort() callback was not set but it tried to call the function as it had the PERF_SAMPLE_CALLCHAIN bit.
--- tools/perf/util/hist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/hist.c +1 -1
@@ -1151,7 +1151,7 @@ void hists__output_resort(struct hists *hists, struct ui_progress *prog)struct perf_evsel *evsel =hists_to_evsel (hists);bool use_callchain; -if (evsel && !symbol_conf.show_ref_callgraph) +if (evsel && symbol_conf.use_callchain && !symbol_conf.show_ref_callgraph) use_callchain = evsel->attr.sample_type &PERF_SAMPLE_CALLCHAIN ;else use_callchain = symbol_conf.use_callchain;