RFR: 7903740: JMH: Perf event validation not working with skid options [v4]
Galder Zamarreño
galder at openjdk.org
Thu Sep 5 16:07:14 UTC 2024
On Thu, 5 Sep 2024 15:51:37 GMT, Galder Zamarreño <galder at openjdk.org> wrote:
>> Failing hard when some events cannot be supported is also proper, I'd think. So there is no need to verify them one by one. Keep it as simple as possible?
>
> The thing is that `perf record` does not always fail when it doesn't work. For example in container ([example](https://github.com/galderz/github-actions/actions/runs/10723692355/job/29737549503)):
>
>
> $ perf record --event cycles --output perf-record-validate.data echo 1
> WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,
> check /proc/sys/kernel/kptr_restrict and /proc/sys/kernel/perf_event_paranoid.
>
> Samples in kernel functions may not be resolved if a suitable vmlinux
> file is not found in the buildid cache or in the vmlinux path.
>
> Samples in kernel modules won't be resolved at all.
>
> If some relocation was applied (e.g. kexec) symbols may be misresolved
> even with a suitable vmlinux or kallsyms file.
>
> Couldn't record kernel reference relocation symbol
> Symbol resolution may be skewed if relocation was used (e.g. kexec).
> Check /proc/kallsyms permission or run as root.
> 1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.001 MB perf-record-validate.data (3 samples) ]
>
> $ echo $?
> 0
>
> $ perf report -q -i perf-record-validate.data --stdio | grep cycles | wc -l
> 0
>
>
> A lot of the issues I was having was because I assumed that in container `perf record` would fail but it doesn't, and later on you get errors saying that no events were recorded.
>
> And in any case, if `perf record` fails, that's already handled by the current code when it calls `!failMsg.isEmpty()`.
>
>> Failing hard when some events cannot be supported is also proper, I'd think. So there is no need to verify them one by one. Keep it as simple as possible?
>
> I'll try to craft a command that checks all the events in one go and if any is missing fail hard.
Oh, here's an interesting thing on containers. Some are outright not supported and `perf record` command fails:
$ perf record --event cycles,branches --output perf-record-validate.data echo 1
Error:
The branches event is not supported.
-------------
PR Review Comment: https://git.openjdk.org/jmh/pull/132#discussion_r1745816471
More information about the jmh-dev
mailing list