Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf pmu: Use available core PMU for raw events

When it finds a matching PMU for a legacy event, it should look for
core PMUs. The raw events also refers to core events so it should be
handled similarly.

On x86, PERF_TYPE_RAW should match with the existing cpu PMU. But on
ARM, there's no PMU with the matching type so it'll pick the first core
PMU for it.

Suggested-by: Ian Rogers <irogers@google.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250507215939.54399-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
c60b7d6f c42e2199

+14 -7
+14 -7
tools/perf/util/pmus.c
··· 727 727 legacy_core_type = 728 728 evsel->core.attr.type == PERF_TYPE_HARDWARE || 729 729 evsel->core.attr.type == PERF_TYPE_HW_CACHE; 730 - if (!pmu && legacy_core_type) { 731 - if (perf_pmus__supports_extended_type()) { 732 - u32 type = evsel->core.attr.config >> PERF_PMU_TYPE_SHIFT; 730 + if (!pmu && legacy_core_type && perf_pmus__supports_extended_type()) { 731 + u32 type = evsel->core.attr.config >> PERF_PMU_TYPE_SHIFT; 733 732 734 - pmu = perf_pmus__find_by_type(type); 735 - } else { 736 - pmu = perf_pmus__find_core_pmu(); 737 - } 733 + pmu = perf_pmus__find_by_type(type); 734 + } 735 + if (!pmu && (legacy_core_type || evsel->core.attr.type == PERF_TYPE_RAW)) { 736 + /* 737 + * For legacy events, if there was no extended type info then 738 + * assume the PMU is the first core PMU. 739 + * 740 + * On architectures like ARM there is no sysfs PMU with type 741 + * PERF_TYPE_RAW, assume the RAW events are going to be handled 742 + * by the first core PMU. 743 + */ 744 + pmu = perf_pmus__find_core_pmu(); 738 745 } 739 746 ((struct evsel *)evsel)->pmu = pmu; 740 747 return pmu;