Skip to content

Commit 808ce56

Browse files
James-A-Clarknamhyung
authored andcommitted
perf test: Fix event parsing test on Arm
The test looks for a PMU from sysfs with type = PERF_TYPE_RAW when opening a raw event. Arm doesn't have a real raw PMU, only core PMUs with unique types other than raw. Instead of looking for a matching PMU, just test that the event type was parsed as raw and skip the PMU search on Arm. The raw event type test should also apply to all platforms so add it outside of the ifdef. Fixes: aefde50 ("perf test: Fix parse-events tests for >1 core PMU") Acked-by: Ian Rogers <[email protected]> Signed-off-by: James Clark <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent b2ad954 commit 808ce56

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tools/perf/tests/parse-events.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,21 @@ static int test__checkevent_raw(struct evlist *evlist)
108108
TEST_ASSERT_VAL("wrong number of entries", 0 != evlist->core.nr_entries);
109109

110110
perf_evlist__for_each_evsel(&evlist->core, evsel) {
111-
struct perf_pmu *pmu = NULL;
111+
struct perf_pmu *pmu __maybe_unused = NULL;
112112
bool type_matched = false;
113113

114114
TEST_ASSERT_VAL("wrong config", test_perf_config(evsel, 0x1a));
115+
TEST_ASSERT_VAL("event not parsed as raw type",
116+
evsel->attr.type == PERF_TYPE_RAW);
117+
#if defined(__aarch64__)
118+
/*
119+
* Arm doesn't have a real raw type PMU in sysfs, so raw events
120+
* would never match any PMU. However, RAW events on Arm will
121+
* always successfully open on the first available core PMU
122+
* so no need to test for a matching type here.
123+
*/
124+
type_matched = raw_type_match = true;
125+
#else
115126
while ((pmu = perf_pmus__scan(pmu)) != NULL) {
116127
if (pmu->type == evsel->attr.type) {
117128
TEST_ASSERT_VAL("PMU type expected once", !type_matched);
@@ -120,6 +131,7 @@ static int test__checkevent_raw(struct evlist *evlist)
120131
raw_type_match = true;
121132
}
122133
}
134+
#endif
123135
TEST_ASSERT_VAL("No PMU found for type", type_matched);
124136
}
125137
TEST_ASSERT_VAL("Raw PMU not matched", raw_type_match);

0 commit comments

Comments
 (0)