Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libperf: Use cpu not index for evsel mmap

Fix issue where evsel's CPU map index was being used as the mmap cpu.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Clarke <pc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Vineet Singh <vineet.singh@intel.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: zhengjun.xing@intel.com
Link: https://lore.kernel.org/r/20220105061351.120843-29-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
47ffe806 7e3d1784

+2 -1
+2 -1
tools/lib/perf/evsel.c
··· 252 252 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { 253 253 int *fd = FD(evsel, idx, thread); 254 254 struct perf_mmap *map; 255 + int cpu = perf_cpu_map__cpu(evsel->cpus, idx); 255 256 256 257 if (fd == NULL || *fd < 0) 257 258 continue; ··· 260 259 map = MMAP(evsel, idx, thread); 261 260 perf_mmap__init(map, NULL, false, NULL); 262 261 263 - ret = perf_mmap__mmap(map, &mp, *fd, idx); 262 + ret = perf_mmap__mmap(map, &mp, *fd, cpu); 264 263 if (ret) { 265 264 perf_evsel__munmap(evsel); 266 265 return ret;