Re: [PATCH 7/8] perf tools: Check fallback error and order
From: Ravi Bangoria
Date: Tue Oct 15 2024 - 00:22:15 EST
> @@ -2366,9 +2403,6 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
> return 0;
>
> try_fallback:
> - if (evsel__precise_ip_fallback(evsel))
> - goto retry_open;
> -
> if (evsel__ignore_missing_thread(evsel, perf_cpu_map__nr(cpus),
> idx, threads, thread, err)) {
> /* We just removed 1 thread, so lower the upper nthreads limit. */
> @@ -2385,11 +2419,15 @@ 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 != -EINVAL || idx > 0 || thread > 0)
> - goto out_close;
> + if (err == -EOPNOTSUPP && evsel__precise_ip_fallback(evsel))
> + goto retry_open;
This will change the behavior of events like instructions:P on AMD.
Without patch:
$ ./perf record -e instructions:P -- true
[ perf record: Woken up 2 times to write data ]
[ perf record: Captured and wrote 0.009 MB perf.data (9 samples) ]
With the patch:
$ ./perf record -e instructions:P -- true
Error:
The instructions:Pu event is not supported.
Thanks,
Ravi