]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.34/perf-report-fix-a-no-annotate-browser-displayed-issue.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.14.34 / perf-report-fix-a-no-annotate-browser-displayed-issue.patch
CommitLineData
df1b7722
GKH
1From foo@baz Mon Apr 9 13:58:16 CEST 2018
2From: Jin Yao <yao.jin@linux.intel.com>
3Date: Tue, 26 Dec 2017 18:42:43 +0800
4Subject: perf report: Fix a no annotate browser displayed issue
5
6From: Jin Yao <yao.jin@linux.intel.com>
7
8
9[ Upstream commit 40c39e3046411f84bab82f66783ff3593e2bcd9b ]
10
11When enabling '-b' option in perf record, for example,
12
13 perf record -b ...
14 perf report
15
16and then browsing the annotate browser from perf report (press 'A'), it
17would fail (annotate browser can't be displayed).
18
19It's because the '.add_entry_cb' op of struct report is overwritten by
20hist_iter__branch_callback() in builtin-report.c. But this function doesn't do
21something like mapping symbols and sources. So next, do_annotate() will return
22directly.
23
24 notes = symbol__annotation(act->ms.sym);
25 if (!notes->src)
26 return 0;
27
28This patch adds the lost code to hist_iter__branch_callback (refer to
29hist_iter__report_callback).
30
31v2:
32
33Fix a crash bug when perform 'perf report --stdio'.
34
35The reason is that we init the symbol annotation only in browser mode, it
36doesn't allocate/init resources for stdio mode.
37
38So now in hist_iter__branch_callback(), it will return directly if it's not in
39browser mode.
40
41Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
42Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
43Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
44Cc: Andi Kleen <ak@linux.intel.com>
45Cc: Jiri Olsa <jolsa@kernel.org>
46Cc: Kan Liang <kan.liang@intel.com>
47Cc: Peter Zijlstra <peterz@infradead.org>
48Link: http://lkml.kernel.org/r/1514284963-18587-1-git-send-email-yao.jin@linux.intel.com
49Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
50Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
51Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
52---
53 tools/perf/builtin-report.c | 18 +++++++++++++++++-
54 1 file changed, 17 insertions(+), 1 deletion(-)
55
56--- a/tools/perf/builtin-report.c
57+++ b/tools/perf/builtin-report.c
58@@ -162,12 +162,28 @@ static int hist_iter__branch_callback(st
59 struct hist_entry *he = iter->he;
60 struct report *rep = arg;
61 struct branch_info *bi;
62+ struct perf_sample *sample = iter->sample;
63+ struct perf_evsel *evsel = iter->evsel;
64+ int err;
65+
66+ if (!ui__has_annotation())
67+ return 0;
68+
69+ hist__account_cycles(sample->branch_stack, al, sample,
70+ rep->nonany_branch_mode);
71
72 bi = he->branch_info;
73+ err = addr_map_symbol__inc_samples(&bi->from, sample, evsel->idx);
74+ if (err)
75+ goto out;
76+
77+ err = addr_map_symbol__inc_samples(&bi->to, sample, evsel->idx);
78+
79 branch_type_count(&rep->brtype_stat, &bi->flags,
80 bi->from.addr, bi->to.addr);
81
82- return 0;
83+out:
84+ return err;
85 }
86
87 static int process_sample_event(struct perf_tool *tool,