Skip to content

Commit

Permalink
perf pmus: Create placholder regardless of scanning core_only
Browse files Browse the repository at this point in the history
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 <irogers@google.com>
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230706183705.601412-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Ian Rogers authored and Arnaldo Carvalho de Melo committed Aug 1, 2023
1 parent 98ce8e4 commit 34bc65d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tools/perf/util/pmus.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,14 @@ static void pmu_read_sysfs(bool core_only)
}

closedir(dir);
if (core_only) {
if (!list_empty(&core_pmus))
read_sysfs_core_pmus = true;
else {
if (perf_pmu__create_placeholder_core_pmu(&core_pmus))
read_sysfs_core_pmus = true;
}
} else {
if (list_empty(&core_pmus)) {
if (!perf_pmu__create_placeholder_core_pmu(&core_pmus))
pr_err("Failure to set up any core PMUs\n");
}
if (!list_empty(&core_pmus)) {
read_sysfs_core_pmus = true;
read_sysfs_all_pmus = true;
if (!core_only)
read_sysfs_all_pmus = true;
}
}

Expand Down

0 comments on commit 34bc65d

Please sign in to comment.