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

Configure Feed

Select the types of activity you want to include in your feed.

perf arm: Workaround ARM PMUs cpu maps having offline cpus

When PMUs have a cpu map in the 'cpus' or 'cpumask' file, perf will
try to open events on those CPUs. ARM doesn't remove offline CPUs
meaning taking a CPU offline will cause perf commands to fail unless a
CPU map is passed on the command line.

More context in:
https://lore.kernel.org/lkml/20240603092812.46616-1-yangyicong@huawei.com/

Reported-by: Yicong Yang <yangyicong@huawei.com>
Closes: https://lore.kernel.org/lkml/20240603092812.46616-2-yangyicong@huawei.com/
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Yicong Yang <yangyicong@hisilicon.com>
Tested-by: Leo Yan <leo.yan@arm.com>
Cc: James Clark <james.clark@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org
Cc: John Garry <john.g.garry@oracle.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240607065343.695369-1-irogers@google.com

authored by

Ian Rogers and committed by
Namhyung Kim
5518063f 3612ca8e

+8 -2
+8 -2
tools/perf/arch/arm/util/pmu.c
··· 11 11 12 12 #include "arm-spe.h" 13 13 #include "hisi-ptt.h" 14 + #include "../../../util/cpumap.h" 14 15 #include "../../../util/pmu.h" 15 16 #include "../../../util/cs-etm.h" 16 17 #include "../../arm64/util/mem-events.h" 17 18 18 - void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused) 19 + void perf_pmu__arch_init(struct perf_pmu *pmu) 19 20 { 21 + struct perf_cpu_map *intersect; 22 + 20 23 #ifdef HAVE_AUXTRACE_SUPPORT 21 24 if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) { 22 25 /* add ETM default config here */ ··· 36 33 pmu->selectable = true; 37 34 #endif 38 35 } 39 - 40 36 #endif 37 + /* Workaround some ARM PMU's failing to correctly set CPU maps for online processors. */ 38 + intersect = perf_cpu_map__intersect(cpu_map__online(), pmu->cpus); 39 + perf_cpu_map__put(pmu->cpus); 40 + pmu->cpus = intersect; 41 41 }