From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751544AbbJBU0O (ORCPT ); Fri, 2 Oct 2015 16:26:14 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:45175 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751396AbbJBU0J (ORCPT ); Fri, 2 Oct 2015 16:26:09 -0400 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Namhyung Kim , Jiri Olsa , Kan Liang , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 04/10] perf report: Fix a bug on "--call-graph none" option Date: Fri, 2 Oct 2015 17:25:39 -0300 Message-Id: <1443817545-8551-5-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1443817545-8551-1-git-send-email-acme@kernel.org> References: <1443817545-8551-1-git-send-email-acme@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namhyung Kim 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. Signed-off-by: Namhyung Kim Tested-by: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Kan Liang Cc: Peter Zijlstra Fixes: f9db0d0f1b2c ("perf callchain: Allow disabling call graphs per event") Link: http://lkml.kernel.org/r/1443587640-24242-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- 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 0cad9e07c5b4..c346b331b892 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -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; -- 2.1.0