summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/pmus.c
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2023-06-01 01:29:53 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-06-01 14:27:30 -0300
commit251aa040244a3b17068e4e6ec61f138d7e50681a (patch)
treefdc9a4c1e702a29808e91f1518a67d37bb79ea8e /tools/perf/util/pmus.c
parent1f4326bf83ce02ae8f7d50240c367fbb7bf28343 (diff)
downloadlinux-stable-251aa040244a3b17068e4e6ec61f138d7e50681a.tar.gz
linux-stable-251aa040244a3b17068e4e6ec61f138d7e50681a.tar.bz2
linux-stable-251aa040244a3b17068e4e6ec61f138d7e50681a.zip
perf parse-events: Wildcard most "numeric" events
Numeric events are either raw events or those with ABI defined numbers matched by the lexer. PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events should wildcard match on hybrid systems. So "cycles" should match each PMU type with an extended type, not just PERF_TYPE_HARDWARE. Change wildcard matching to add the event even if wildcard PMU scanning fails, there will be no extended type but this best matches previous behavior. Only set the extended type when the event type supports it and when perf_pmus__supports_extended_type is true. This new function returns true if >1 core PMU and avoids potential errors on older kernels. Modify evsel__compute_group_pmu_name using a helper perf_pmu__is_software to determine when grouping should occur. Try to use PMUs, and evsel__find_pmu, as being more dependable than evsel->pmu_name. Set a parse events error if a hardware term's PMU lookup fails, to provide extra diagnostics. Fixes: 8bc75f699c141420 ("perf parse-events: Support wildcards on raw events") Reported-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Kan Liang <kan.liang@linux.intel.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> 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> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Link: https://lore.kernel.org/r/20230601082954.754318-4-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/pmus.c')
-rw-r--r--tools/perf/util/pmus.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/perf/util/pmus.c b/tools/perf/util/pmus.c
index 53f11f6ce878..e1d0a93147e5 100644
--- a/tools/perf/util/pmus.c
+++ b/tools/perf/util/pmus.c
@@ -477,6 +477,11 @@ int perf_pmus__num_core_pmus(void)
return count;
}
+bool perf_pmus__supports_extended_type(void)
+{
+ return perf_pmus__num_core_pmus() > 1;
+}
+
struct perf_pmu *evsel__find_pmu(const struct evsel *evsel)
{
struct perf_pmu *pmu = evsel->pmu;