From 9bb93278c35d658057f513ba25ffb2b5204c2b9e Mon Sep 17 00:00:00 2001 From: James Clark Date: Thu, 4 Dec 2025 09:10:53 +0000 Subject: [PATCH] perf tools: Always uniquify event names evlist__uniquify_evsel_names() only gets called in __parse_events() if verbose is > 0. This means that the auto added "slots" events stay as "slots" rather than being expanded to "cpu_core/slots/" unless Perf is run in verbose mode. This is invisible to users when running Perf stat because evlist__print_counters() always calls it regardless of verbose mode before displaying. The only thing this seems to affect is the test "Parsing of all PMU events from sysfs" which fails when not run in verbose mode. test__checkevent_pmu_events() always expects event names to be prefixed with the pmu name, but this only happens for "slots" events after evlist__uniquify_evsel_names() is called. One fix could be to relax the test to accept the non prefixed name in normal mode. But seeing as Perf stat uniquifies unconditionally, make parse_events() do the same. This fixes the following test failure: $ perf test "Parsing of all PMU events from sysfs" 5.2: Parsing of all PMU events from sysfs : FAILED! $ Reviewed-by: Ian Rogers Signed-off-by: James Clark Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ingo Molnar Cc: Jiri Olsa Cc: Leo Yan Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index c8f2962a06c7..6e1185d7be1b 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -2247,12 +2247,12 @@ int __parse_events(struct evlist *evlist, const char *str, const char *pmu_filte evlist__splice_list_tail(evlist, &parse_state.list); if (ret2 && warn_if_reordered && !parse_state.wild_card_pmus) { + evlist__uniquify_evsel_names(evlist, &stat_config); pr_warning("WARNING: events were regrouped to match PMUs\n"); if (verbose > 0) { struct strbuf sb = STRBUF_INIT; - evlist__uniquify_evsel_names(evlist, &stat_config); evlist__format_evsels(evlist, &sb, 2048); pr_debug("evlist after sorting/fixing: '%s'\n", sb.buf); strbuf_release(&sb); -- 2.47.3