Commit 5752c20f authored by Ravi Bangoria's avatar Ravi Bangoria Committed by Arnaldo Carvalho de Melo

perf mem: Scan all PMUs instead of just core ones

Scanning only core PMUs is not sufficient on platforms like AMD since
perf mem on AMD uses IBS OP PMU, which is independent of core PMU.
Scan all PMUs instead of just core PMUs. There should be negligible
performance overhead because of scanning all PMUs, so we should be okay.
Reviewed-by: default avatarIan Rogers <irogers@google.com>
Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ali Saidi <alisaidi@amazon.com>
Cc: Ananth Narayan <ananth.narayan@amd.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Santosh Shukla <santosh.shukla@amd.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Link: https://lore.kernel.org/r/20230615051700.1833-4-ravi.bangoria@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f0dc2082
...@@ -130,7 +130,12 @@ int perf_mem_events__init(void) ...@@ -130,7 +130,12 @@ int perf_mem_events__init(void)
if (!e->tag) if (!e->tag)
continue; continue;
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) { /*
* Scan all PMUs not just core ones, since perf mem/c2c on
* platforms like AMD uses IBS OP PMU which is independent
* of core PMU.
*/
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
scnprintf(sysfs_name, sizeof(sysfs_name), e->sysfs_name, pmu->name); scnprintf(sysfs_name, sizeof(sysfs_name), e->sysfs_name, pmu->name);
e->supported |= perf_mem_event__supported(mnt, sysfs_name); e->supported |= perf_mem_event__supported(mnt, sysfs_name);
} }
...@@ -165,7 +170,7 @@ static void perf_mem_events__print_unsupport_hybrid(struct perf_mem_event *e, ...@@ -165,7 +170,7 @@ static void perf_mem_events__print_unsupport_hybrid(struct perf_mem_event *e,
char sysfs_name[100]; char sysfs_name[100];
struct perf_pmu *pmu = NULL; struct perf_pmu *pmu = NULL;
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) { while ((pmu = perf_pmus__scan(pmu)) != NULL) {
scnprintf(sysfs_name, sizeof(sysfs_name), e->sysfs_name, scnprintf(sysfs_name, sizeof(sysfs_name), e->sysfs_name,
pmu->name); pmu->name);
if (!perf_mem_event__supported(mnt, sysfs_name)) { if (!perf_mem_event__supported(mnt, sysfs_name)) {
...@@ -188,7 +193,7 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr, ...@@ -188,7 +193,7 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr,
if (!e->record) if (!e->record)
continue; continue;
if (perf_pmus__num_core_pmus() == 1) { if (perf_pmus__num_mem_pmus() == 1) {
if (!e->supported) { if (!e->supported) {
pr_err("failed: event '%s' not supported\n", pr_err("failed: event '%s' not supported\n",
perf_mem_events__name(j, NULL)); perf_mem_events__name(j, NULL));
...@@ -203,7 +208,7 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr, ...@@ -203,7 +208,7 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr,
return -1; return -1;
} }
while ((pmu = perf_pmus__scan_core(pmu)) != NULL) { while ((pmu = perf_pmus__scan(pmu)) != NULL) {
rec_argv[i++] = "-e"; rec_argv[i++] = "-e";
s = perf_mem_events__name(j, pmu->name); s = perf_mem_events__name(j, pmu->name);
if (s) { if (s) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment