Re: [linus:master] [perf tools] af954f76ee: perf-sanity-tests.Test_data_symbol.fail
From: Namhyung Kim
Date: Wed Dec 04 2024 - 17:21:14 EST
On Wed, Dec 04, 2024 at 01:44:06PM -0800, Namhyung Kim wrote:
[SNIP]
> perf_event_attr:
> type 4 (cpu)
> size 136
> config 0x1cd (mem-loads)
> { sample_period, sample_freq } 4000
> sample_type IP|TID|TIME|ADDR|CPU|PERIOD|IDENTIFIER|DATA_SRC|WEIGHT_STRUCT
> read_format ID|LOST
> freq 1
> precise_ip 3
> sample_id_all 1
> { bp_addr, config1 } 0x1f
> ------------------------------------------------------------
> sys_perf_event_open: pid -1 cpu 0 group_fd 5 flags 0x8
> sys_perf_event_open failed, error -22
> Using PERF_SAMPLE_READ / :S modifier is not compatible with inherit, falling back to no-inherit.
> Error:
> The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cpu/mem-loads,ldlat=30/).
> "dmesg | grep -i perf" may provide additional information.
>
> There's an issue with fallback on the inherit bit with the sample read.
> I'll take a look.
Hmm, no. It doesn't have neight SAMPLE_READ nor inherit. So the error
message was misleading. Maybe it should be printed when it actually
clears the bits.
Anyway, I've tested with the old code and realzed that it might be due
to precise_ip being 3. I expected it'd return EOPNOTSUPP for the case
but it seems to return EINVAL sometimes. Then it should check it after
the missing features like below. Can you please test?
Thanks,
Namhyung
---8<---
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f745723d486ba962..d22c5df1701eccc5 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2571,12 +2571,12 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
if (err == -EMFILE && rlimit__increase_nofile(&set_rlimit))
goto retry_open;
- if (err == -EOPNOTSUPP && evsel__precise_ip_fallback(evsel))
- goto retry_open;
-
if (err == -EINVAL && evsel__detect_missing_features(evsel))
goto fallback_missing_features;
+ if (evsel__precise_ip_fallback(evsel))
+ goto retry_open;
+
if (evsel__handle_error_quirks(evsel, err))
goto retry_open;