[PATCH v1 1/2] perf evsel: Add per-thread warning for EOPNOTSUPP open failues

From: Ian Rogers
Date: Fri Apr 11 2025 - 20:47:19 EST


The mrvl_ddr_pmu will return EOPNOTSUPP if opened in per-thread
mode. Give a warning for this similar to EINVAL. Doing this better
supports metric testing with limited permissions when the mrvl_ddr_pmu
is present, as the failure to open causes the test to skip and not
fail.

Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/util/evsel.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 1974395492d7..a8a8afb78f00 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -3774,6 +3774,10 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
return scnprintf(msg, size, "%s",
"No hardware sampling interrupt available.\n");
#endif
+ if (!target__has_cpu(target))
+ return scnprintf(msg, size,
+ "Unsupported event (%s) in per-thread mode, enable system wide with '-a'.",
+ evsel__name(evsel));
break;
case EBUSY:
if (find_process("oprofiled"))
--
2.49.0.604.gff1f9ca942-goog