Skip to content

Commit 34bc65d

Browse files
captain5050acmel
authored andcommitted
perf pmus: Create placholder regardless of scanning core_only
If scanning all PMUs the placeholder is still necessary if no core PMU is found. This situation occurs in perf test's parse-events test, when uncore events appear before core. Fixes: 628eaa4 ("perf pmus: Add placeholder core PMU") Signed-off-by: Ian Rogers <[email protected]> Tested-by: Thomas Richter <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 98ce8e4 commit 34bc65d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

tools/perf/util/pmus.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,14 @@ static void pmu_read_sysfs(bool core_only)
152152
}
153153

154154
closedir(dir);
155-
if (core_only) {
156-
if (!list_empty(&core_pmus))
157-
read_sysfs_core_pmus = true;
158-
else {
159-
if (perf_pmu__create_placeholder_core_pmu(&core_pmus))
160-
read_sysfs_core_pmus = true;
161-
}
162-
} else {
155+
if (list_empty(&core_pmus)) {
156+
if (!perf_pmu__create_placeholder_core_pmu(&core_pmus))
157+
pr_err("Failure to set up any core PMUs\n");
158+
}
159+
if (!list_empty(&core_pmus)) {
163160
read_sysfs_core_pmus = true;
164-
read_sysfs_all_pmus = true;
161+
if (!core_only)
162+
read_sysfs_all_pmus = true;
165163
}
166164
}
167165

0 commit comments

Comments
 (0)