[PATCH] perf evsel amd: Fix IBS error message

From: Ravi Bangoria
Date: Wed Jun 21 2023 - 02:24:31 EST


AMD IBS can do per-process profiling[1] and is no longer restricted to
per-cpu or systemwide only. Remove stale error message.

Before:
$ sudo ./perf record -e "{ibs_op//,ibs_op//}" -C 0
Error:
AMD IBS may only be available in system-wide/per-cpu mode.
Try using -a, or -C and workload affinity

After:
$ sudo ./perf record -e "{ibs_op//,ibs_op//}" -C 0
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid
argument) for event (ibs_op//).
/bin/dmesg | grep -i perf may provide additional information.

[1] https://git.kernel.org/torvalds/c/30093056f7b2

Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxx>
---
tools/perf/util/evsel.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 356c07f03be6..65b0b70830f0 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -3092,14 +3092,10 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
return scnprintf(msg, size,
"Invalid event (%s) in per-thread mode, enable system wide with '-a'.",
evsel__name(evsel));
- if (is_amd(arch, cpuid)) {
- if (is_amd_ibs(evsel)) {
- if (evsel->core.attr.exclude_kernel)
- return scnprintf(msg, size,
+ if (is_amd(arch, cpuid) && is_amd_ibs(evsel)) {
+ if (evsel->core.attr.exclude_kernel) {
+ return scnprintf(msg, size,
"AMD IBS can't exclude kernel events. Try running at a higher privilege level.");
- if (!evsel->core.system_wide)
- return scnprintf(msg, size,
- "AMD IBS may only be available in system-wide/per-cpu mode. Try using -a, or -C and workload affinity");
}
}

--
2.41.0