[lkml]   [2018]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH AUTOSEL 4.18 047/131] perf c2c report: Fix crash for empty browser
From: Jiri Olsa <>

[ Upstream commit 73978332572ccf5e364c31e9a70ba953f8202b46 ]

'perf c2c' scans read/write accesses and tries to find false sharing
cases, so when the events it wants were not asked for or ended up not
taking place, we get no histograms.

So do not try to display entry details if there's not any. Currently
this ends up in crash:

$ perf c2c report # then press 'd'
perf: Segmentation fault

Committer testing:


Record a file without events of interest to 'perf c2c report',
then call it and press 'd':

# perf record sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.001 MB (6 samples) ]
# perf c2c report
perf: Segmentation fault
-------- backtrace --------

After the patch the segfault doesn't take place, a follow up patch to
tell the user why nothing changes when 'd' is pressed would be good.

Signed-off-by: Jiri Olsa <>
Tested-by: Arnaldo Carvalho de Melo <>
Cc: Alexander Shishkin <>
Cc: David Ahern <>
Cc: Don Zickus <>
Cc: Joe Mario <>
Cc: Namhyung Kim <>
Cc: Peter Zijlstra <>
Fixes: f1c5fd4d0bb9 ("perf c2c report: Add TUI cacheline browser")
Signed-off-by: Arnaldo Carvalho de Melo <>
Signed-off-by: Sasha Levin <>
tools/perf/builtin-c2c.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 6a8738f7ead3..eab66e3b0a19 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -2349,6 +2349,9 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
" s Toggle full length of symbol and source line columns \n"
" q Return back to cacheline list \n";

+ if (!he)
+ return 0;
/* Display compact version first. */
c2c.symbol_full = false;

 \ /
  Last update: 2018-09-02 15:34    [W:0.589 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site