diff options
author | Ian Rogers <[email protected]> | 2022-07-25 15:36:02 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2022-07-26 16:31:55 -0300 |
commit | a061a8ad3f906d331020006084558e2acddc2ff7 (patch) | |
tree | a097be7bccd70546b7d0f696bef45a1d99871ae0 | |
parent | bedd17381b9cc34ad20c1d545a4ed2dfbb4d8068 (diff) |
perf test: Avoid sysfs state affecting fake events
Icelake has a slots event, on my Skylakex I have CPU events in sysfs of
topdown-slots-issued and topdown-total-slots.
Legacy event parsing would try to use '-' to separate parts of an event
and so perf_pmu__parse_init sets 'slots' to be a
PMU_EVENT_SYMBOL_SUFFIX2.
As such parsing the slots event for a fake PMU fails as a
PMU_EVENT_SYMBOL_SUFFIX2 isn't made into the PE_PMU_EVENT_FAKE token.
Resolve this issue by test initializing the PMU parsing state before
every parse. This must be done every parse as the state is removes after
each parse_events.
Signed-off-by: Ian Rogers <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Caleb Biggers <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: John Garry <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Kshipra Bopardikar <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Perry Taylor <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sedat Dilek <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Xing Zhengjun <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/tests/pmu-events.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c index 478b33825790..263cbb67c861 100644 --- a/tools/perf/tests/pmu-events.c +++ b/tools/perf/tests/pmu-events.c @@ -812,6 +812,15 @@ static int check_parse_id(const char *id, struct parse_events_error *error, for (cur = strchr(dup, '@') ; cur; cur = strchr(++cur, '@')) *cur = '/'; + if (fake_pmu) { + /* + * Every call to __parse_events will try to initialize the PMU + * state from sysfs and then clean it up at the end. Reset the + * PMU events to the test state so that we don't pick up + * erroneous prefixes and suffixes. + */ + perf_pmu__test_parse_init(); + } ret = __parse_events(evlist, dup, error, fake_pmu); free(dup); |