summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/mem-events.c
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2023-05-27 00:21:59 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-05-27 09:41:09 -0300
commitabe9544ea78a2e0c3cc92b4410a57a9c0732293f (patch)
treeb0cab198224fa0538d84fbf84157534011fc3555 /tools/perf/util/mem-events.c
parent3d88055f081056be6448a2628ad815d88d7ed570 (diff)
downloadlinux-stable-abe9544ea78a2e0c3cc92b4410a57a9c0732293f.tar.gz
linux-stable-abe9544ea78a2e0c3cc92b4410a57a9c0732293f.tar.bz2
linux-stable-abe9544ea78a2e0c3cc92b4410a57a9c0732293f.zip
perf mem: Avoid hybrid PMU list
Add perf_pmu__num_mem_pmus that scans/counts the number of PMUs for mem events. Switch perf_pmu__for_each_hybrid_pmu to iterating all PMUs and only handling is_core ones. Reviewed-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ali Saidi <alisaidi@amazon.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Dmitrii Dolgov <9erthalion6@gmail.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jing Zhang <renyu.zj@linux.alibaba.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kang Minchul <tegongkang@gmail.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Ming Wang <wangming01@loongson.cn> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Rob Herring <robh@kernel.org> Cc: Sandipan Das <sandipan.das@amd.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Will Deacon <will@kernel.org> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/20230527072210.2900565-24-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/mem-events.c')
-rw-r--r--tools/perf/util/mem-events.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index ed1ee4b05356..c9e422a38258 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -13,7 +13,6 @@
#include "debug.h"
#include "symbol.h"
#include "pmu.h"
-#include "pmu-hybrid.h"
unsigned int perf_mem_events__loads_ldlat = 30;
@@ -120,7 +119,6 @@ int perf_mem_events__init(void)
for (j = 0; j < PERF_MEM_EVENTS__MAX; j++) {
struct perf_mem_event *e = perf_mem_events__ptr(j);
- struct perf_pmu *pmu;
char sysfs_name[100];
/*
@@ -135,7 +133,12 @@ int perf_mem_events__init(void)
e->sysfs_name, "cpu");
e->supported = perf_mem_event__supported(mnt, sysfs_name);
} else {
- perf_pmu__for_each_hybrid_pmu(pmu) {
+ struct perf_pmu *pmu = NULL;
+
+ while ((pmu = perf_pmu__scan(pmu)) != NULL) {
+ if (!pmu->is_core)
+ continue;
+
scnprintf(sysfs_name, sizeof(sysfs_name),
e->sysfs_name, pmu->name);
e->supported |= perf_mem_event__supported(mnt, sysfs_name);
@@ -170,9 +173,12 @@ static void perf_mem_events__print_unsupport_hybrid(struct perf_mem_event *e,
{
const char *mnt = sysfs__mount();
char sysfs_name[100];
- struct perf_pmu *pmu;
+ struct perf_pmu *pmu = NULL;
+
+ while ((pmu = perf_pmu__scan(pmu)) != NULL) {
+ if (!pmu->is_core)
+ continue;
- perf_pmu__for_each_hybrid_pmu(pmu) {
scnprintf(sysfs_name, sizeof(sysfs_name), e->sysfs_name,
pmu->name);
if (!perf_mem_event__supported(mnt, sysfs_name)) {
@@ -210,7 +216,9 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr,
return -1;
}
- perf_pmu__for_each_hybrid_pmu(pmu) {
+ while ((pmu = perf_pmu__scan(pmu)) != NULL) {
+ if (!pmu->is_core)
+ continue;
rec_argv[i++] = "-e";
s = perf_mem_events__name(j, pmu->name);
if (s) {