Skip to content

Commit 6d44488

Browse files
James-A-Clarksmb49
authored andcommitted
perf evlist: Fix evlist__new_default() for > 1 core PMU
BugLink: https://bugs.launchpad.net/bugs/2059991 [ Upstream commit 7814fe2 ] The 'Session topology' test currently fails with this message when evlist__new_default() opens more than one event: 32: Session topology : --- start --- templ file: /tmp/perf-test-vv5YzZ Using CPUID 0x00000000410fd070 Opening: unknown-hardware:HG ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) config 0xb00000000 disabled 1 ------------------------------------------------------------ sys_perf_event_open: pid 0 cpu -1 group_fd -1 flags 0x8 = 4 Opening: unknown-hardware:HG ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) config 0xa00000000 disabled 1 ------------------------------------------------------------ sys_perf_event_open: pid 0 cpu -1 group_fd -1 flags 0x8 = 5 non matching sample_type FAILED tests/topology.c:73 can't get session ---- end ---- Session topology: FAILED! This is because when re-opening the file and parsing the header, Perf expects that any file that has more than one event has the sample ID flag set. Perf record already sets the flag in a similar way when there is more than one event, so add the same logic to evlist__new_default(). evlist__new_default() is only currently used in tests, so I don't expect this change to have any other side effects. The other tests that use it don't save and re-open the file so don't hit this issue. The session topology test has been failing on Arm big.LITTLE platforms since commit 251aa04 ("perf parse-events: Wildcard most "numeric" events") when evlist__new_default() started opening multiple events for 'cycles'. Fixes: 251aa04 ("perf parse-events: Wildcard most "numeric" events") Reviewed-by: Ian Rogers <[email protected]> Signed-off-by: James Clark <[email protected]> [ This was failing as well on a Rocket Lake Refresh/14700k Intel hybrid system - Arnaldo ] Tested-by: Arnaldo Carvalho de Melo <[email protected]> Tested-by: Ian Rogers <[email protected]> Tested-by: Kan Liang <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Changbin Du <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Yang Jihong <[email protected]> Closes: https://lore.kernel.org/lkml/CAP-5=fWVQ-7ijjK3-w1q+k2WYVNHbAcejb-xY0ptbjRw476VKA@mail.gmail.com/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Portia Stephens <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent fbfd4c1 commit 6d44488

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/perf/util/evlist.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ struct evlist *evlist__new_default(void)
103103
err = parse_event(evlist, can_profile_kernel ? "cycles:P" : "cycles:Pu");
104104
if (err) {
105105
evlist__delete(evlist);
106-
evlist = NULL;
106+
return NULL;
107+
}
108+
109+
if (evlist->core.nr_entries > 1) {
110+
struct evsel *evsel;
111+
112+
evlist__for_each_entry(evlist, evsel)
113+
evsel__set_sample_id(evsel, /*can_sample_identifier=*/false);
107114
}
108115

109116
return evlist;

0 commit comments

Comments
 (0)