summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2020-01-10 18:15:37 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-01-14 18:02:19 +0300
commitcb71f7d43ece3d5a4f400f510c61b2ec7c9ce9a1 (patch)
treec634b8ca75de9215205c4638fa5e1093fd1c5018 /tools/lib
parentc3314a74f86dc00827e0945c8e5039fc3aebaa3c (diff)
downloadlinux-cb71f7d43ece3d5a4f400f510c61b2ec7c9ce9a1.tar.xz
libperf: Setup initial evlist::all_cpus value
Jann Horn reported crash in perf ftrace because evlist::all_cpus isn't initialized if there's evlist without events, which is the case for perf ftrace. Adding initial initialization of evlist::all_cpus from given cpus, regardless of events in the evlist. Fixes: 7736627b865d ("perf stat: Use affinity for closing file descriptors") Reported-by: Jann Horn <jannh@google.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Andi Kleen <ak@linux.intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20200110151537.153012-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/perf/evlist.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c
index ae9e65aa2491..5b9f2ca50591 100644
--- a/tools/lib/perf/evlist.c
+++ b/tools/lib/perf/evlist.c
@@ -164,6 +164,9 @@ void perf_evlist__set_maps(struct perf_evlist *evlist,
evlist->threads = perf_thread_map__get(threads);
}
+ if (!evlist->all_cpus && cpus)
+ evlist->all_cpus = perf_cpu_map__get(cpus);
+
perf_evlist__propagate_maps(evlist);
}