]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
e62801754c1b0ef99d89711984e9828c411e21fc
[thirdparty/kernel/stable-queue.git] /
1 From foo@baz Sat Nov 10 10:48:43 PST 2018
2 From: Jiri Olsa <jolsa@redhat.com>
3 Date: Wed, 3 Oct 2018 23:20:52 +0200
4 Subject: perf evsel: Store ids for events with their own cpus perf_event__synthesize_event_update_cpus
5
6 From: Jiri Olsa <jolsa@redhat.com>
7
8 [ Upstream commit 4ab8455f8bd83298bf7f67ab9357e3b1cc765c7d ]
9
10 John reported crash when recording on an event under PMU with cpumask defined:
11
12 root@localhost:~# ./perf_debug_ record -e armv8_pmuv3_0/br_mis_pred/ sleep 1
13 perf: Segmentation fault
14 Obtained 9 stack frames.
15 ./perf_debug_() [0x4c5ef8]
16 [0xffff82ba267c]
17 ./perf_debug_() [0x4bc5a8]
18 ./perf_debug_() [0x419550]
19 ./perf_debug_() [0x41a928]
20 ./perf_debug_() [0x472f58]
21 ./perf_debug_() [0x473210]
22 ./perf_debug_() [0x4070f4]
23 /lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe0) [0xffff8294c8a0]
24 Segmentation fault (core dumped)
25
26 We synthesize an update event that needs to touch the evsel id array, which is
27 not defined at that time. Fixing this by forcing the id allocation for events
28 with their own cpus.
29
30 Reported-by: John Garry <john.garry@huawei.com>
31 Signed-off-by: Jiri Olsa <jolsa@kernel.org>
32 Tested-by: John Garry <john.garry@huawei.com>
33 Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
34 Cc: Andi Kleen <ak@linux.intel.com>
35 Cc: Mark Rutland <mark.rutland@arm.com>
36 Cc: Namhyung Kim <namhyung@kernel.org>
37 Cc: Peter Zijlstra <peterz@infradead.org>
38 Cc: Will Deacon <will.deacon@arm.com>
39 Cc: linux-arm-kernel@lists.infradead.org
40 Cc: linuxarm@huawei.com
41 Fixes: bfd8f72c2778 ("perf record: Synthesize unit/scale/... in event update")
42 Link: http://lkml.kernel.org/r/20181003212052.GA32371@krava
43 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
44 Signed-off-by: Sasha Levin <sashal@kernel.org>
45 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
46 ---
47 tools/perf/builtin-report.c | 1 +
48 tools/perf/util/evsel.c | 3 +++
49 2 files changed, 4 insertions(+)
50
51 --- a/tools/perf/builtin-report.c
52 +++ b/tools/perf/builtin-report.c
53 @@ -981,6 +981,7 @@ int cmd_report(int argc, const char **ar
54 .id_index = perf_event__process_id_index,
55 .auxtrace_info = perf_event__process_auxtrace_info,
56 .auxtrace = perf_event__process_auxtrace,
57 + .event_update = perf_event__process_event_update,
58 .feature = process_feature_event,
59 .ordered_events = true,
60 .ordering_requires_timestamps = true,
61 --- a/tools/perf/util/evsel.c
62 +++ b/tools/perf/util/evsel.c
63 @@ -1078,6 +1078,9 @@ void perf_evsel__config(struct perf_evse
64 attr->exclude_user = 1;
65 }
66
67 + if (evsel->own_cpus)
68 + evsel->attr.read_format |= PERF_FORMAT_ID;
69 +
70 /*
71 * Apply event specific term settings,
72 * it overloads any global configuration.