[PATCH v2 01/30] perf pmus: Don't skip core PMUs as duplicates

From: Ian Rogers

Date: Fri Nov 13 2026 - 14:59:59 EST


perf_pmus__scan_skip_duplicates() skips a PMU whose name, without a
numeric suffix, matches the previous PMU's. This is intended for uncore
PMUs, such as uncore_cha_0 and uncore_cha_1, that have the same events.
The check was also applied to core PMUs, but core PMUs of heterogeneous
systems may differ only by such a suffix while having different events.
For example, ARM ACPI systems with two kinds of core name their PMUs
armv8_pmuv3_0 and armv8_pmuv3_1, and devicetree systems may name them
armv8_cortex_a53 and armv8_cortex_a57 where "a53" and "a57" are hex
suffixes. Only the first core PMU was listed by "perf list" and the
events of the other core PMUs were missing.

Before, on such a system, "perf list" and "perf list --unit=<pmu>" only
showed the events of the first core PMU, the scan having skipped the
others. After, the events of every core PMU are shown, as on Intel
hybrid systems with cpu_core and cpu_atom PMUs. Uncore PMU deduplication
is unchanged and pmu_deduped_name_len() already avoided removing the
suffix of core PMU names when printing events. Similarly avoid removing
the suffix of core PMU names in the raw event encodings that "perf list"
shows for each PMU, so that each core PMU's encoding is shown with its
own name.

Fixes: cd4e1efbbc40 ("perf pmus: Skip duplicate PMUs and don't print list suffix by default")
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/util/pmus.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/pmus.c b/tools/perf/util/pmus.c
index 1355b317f3ed..4f4632f48e16 100644
--- a/tools/perf/util/pmus.c
+++ b/tools/perf/util/pmus.c
@@ -465,15 +465,14 @@ static struct perf_pmu *perf_pmus__scan_skip_duplicates(struct perf_pmu *pmu)
last_pmu_name_len = pmu_name_len_no_suffix(pmu->name ?: "");

if (use_core_pmus) {
- list_for_each_entry_continue(pmu, &core_pmus, list) {
- int pmu_name_len = pmu_name_len_no_suffix(pmu->name ?: "");
-
- if (last_pmu_name_len == pmu_name_len &&
- !strncmp(last_pmu_name, pmu->name ?: "", pmu_name_len))
- continue;
-
+ /*
+ * Core PMUs, such as armv8_cortex_a53 and armv8_cortex_a57,
+ * may differ only by a suffix but have different events, so
+ * they are never duplicates.
+ */
+ list_for_each_entry_continue(pmu, &core_pmus, list)
return pmu;
- }
+
pmu = NULL;
pmu = list_prepare_entry(pmu, &other_pmus, list);
}
@@ -762,7 +761,9 @@ void perf_pmus__print_raw_pmu_events(const struct print_callbacks *print_cb, voi
.long_string = STRBUF_INIT,
.num_formats = 0,
};
- int len = pmu_name_len_no_suffix(pmu->name);
+ /* Core PMUs aren't duplicates so keep their suffix. */
+ int len = pmu->is_core ? (int)strlen(pmu->name)
+ : (int)pmu_name_len_no_suffix(pmu->name);
const char *desc = "(see 'man perf-list' or 'man perf-record' on how to encode it)";

if (!pmu->is_core)
--
2.56.1.703.gf848ed807c-goog