summaryrefslogtreecommitdiffstats
path: root/tools/perf/arch/arm64
diff options
context:
space:
mode:
authorJames Clark <james.clark@arm.com>2023-09-13 17:33:49 +0200
committerNamhyung Kim <namhyung@kernel.org>2023-09-16 01:46:40 +0200
commit105e5b433e5c743bcdb4956b00b772dfddbee455 (patch)
treead7f07de2d73d9fdb0e7f73671de7fd6916a68d1 /tools/perf/arch/arm64
parentperf pmu: Move pmu__find_core_pmu() to pmus.c (diff)
downloadlinux-105e5b433e5c743bcdb4956b00b772dfddbee455.tar.xz
linux-105e5b433e5c743bcdb4956b00b772dfddbee455.zip
perf pmus: Simplify perf_pmus__find_core_pmu()
Currently the while loop always either exits on the first iteration with a core PMU, or exits with NULL on heterogeneous systems or when not all CPUs are online. Both of the latter behaviors are undesirable for platforms other than Arm so simplify it to always return the first core PMU, or NULL if none exist. This behavior was depended on by the Arm version of pmu_metrics_table__find(), so the logic has been moved there instead. Signed-off-by: James Clark <james.clark@arm.com> Suggested-by: Ian Rogers <irogers@google.com> Reviewed-by: Ian Rogers <irogers@google.com> Reviewed-by: John Garry <john.g.garry@oracle.com> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Eduard Zingerman <eddyz87@gmail.com> Cc: Will Deacon <will@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Jing Zhang <renyu.zj@linux.alibaba.com> Cc: Haixin Yu <yuhaixin.yhx@linux.alibaba.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/20230913153355.138331-3-james.clark@arm.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/arch/arm64')
-rw-r--r--tools/perf/arch/arm64/util/pmu.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/arch/arm64/util/pmu.c b/tools/perf/arch/arm64/util/pmu.c
index 3d9330feebd2..3099f5f448ba 100644
--- a/tools/perf/arch/arm64/util/pmu.c
+++ b/tools/perf/arch/arm64/util/pmu.c
@@ -10,8 +10,14 @@
const struct pmu_metrics_table *pmu_metrics_table__find(void)
{
- struct perf_pmu *pmu = perf_pmus__find_core_pmu();
+ struct perf_pmu *pmu;
+
+ /* Metrics aren't currently supported on heterogeneous Arm systems */
+ if (perf_pmus__num_core_pmus() > 1)
+ return NULL;
+ /* Doesn't matter which one here because they'll all be the same */
+ pmu = perf_pmus__find_core_pmu();
if (pmu)
return perf_pmu__find_metrics_table(pmu);