All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf report: Fix a bug on "--call-graph none" option
@ 2015-09-30  4:34 Namhyung Kim
  2015-09-30 22:03 ` Arnaldo Carvalho de Melo
  2015-10-03  7:49 ` [tip:perf/core] " tip-bot for Namhyung Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Namhyung Kim @ 2015-09-30  4:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Kan Liang

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.

Cc: Kan Liang <kan.liang@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b3567a25f0c4..99b8e14ce010 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -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;
-- 
2.5.0


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

end of thread, other threads:[~2015-10-03  7:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30  4:34 [PATCH] perf report: Fix a bug on "--call-graph none" option Namhyung Kim
2015-09-30 22:03 ` Arnaldo Carvalho de Melo
2015-10-03  7:49 ` [tip:perf/core] " tip-bot for Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.