perf timer should work on non-Intel
Opened this issue · 4 comments
Right now --timer=perf
fails on non-Intel platforms (and even on Intel platforms if the event file is not downloaded or not found for the current platform), with the obscure error ERROR: jevents failed while reading events, error -5
as described in #83.
This is because we rely on jevents, which is Intel-only as both the event source and event configuration and sampling code. We should more away from jevents for both things (using libpfm4 for the event lists, which is the more complex of the two which we already do in libpfm).
Probably we can introduce a new --timer=perf-generic
using the generic implementation and leave the old one alone for now.
Hello, when I'm running uarch-bench in my virtual machine (ubuntu 20.04) with the i7-10700 CPU, this problem occurred.
I am wondering where I can get the events file or how to solve it.
Thank you very much!
Hello, when I'm running uarch-bench in my virtual machine (ubuntu 20.04) with the i7-10700 CPU, this problem occurred.
I am wondering where I can get the events file or how to solve it.
Thank you very much!
Hi meop0,
Does the VM have network access?
Most VMs don't pass through performance counters, so even if you resolve this problem, I wouldn't expect it to work with --timer=perf
. You can see if your VM supports perf events by installing the perf
tool and trying something like: perf stat sleep 1s
. If that shows cycles
as one of the outputs then I guess it is working!
If you want to see what event file uarch-bench is trying to look for, you can try this:
strace ./uarch-bench --timer=perf --test-name=foo 2>&1 | grep 'pmu-events'
That said, since I don't think perf events will work in your VM, you can just use the default --timer=clock
instead.
Hello, when I'm running uarch-bench in my virtual machine (ubuntu 20.04) with the i7-10700 CPU, this problem occurred.
I am wondering where I can get the events file or how to solve it.
Thank you very much!Hi meop0,
Does the VM have network access?
Most VMs don't pass through performance counters, so even if you resolve this problem, I wouldn't expect it to work with
--timer=perf
. You can see if your VM supports perf events by installing theperf
tool and trying something like:perf stat sleep 1s
. If that showscycles
as one of the outputs then I guess it is working!If you want to see what event file uarch-bench is trying to look for, you can try this:
strace ./uarch-bench --timer=perf --test-name=foo 2>&1 | grep 'pmu-events'
That said, since I don't think perf events will work in your VM, you can just use the default
--timer=clock
instead.
It turns out that pmu-tools/event_download.py
didn't work properly and thus files were missing. It can be fixed by just sudo make
again. (I don't know why I missed the error message.)
Besides, VMware can virtualize the CPU counters and perf
works, though I don't know if there is any difference. Maybe I will write a blog about it later.
However, the PFC submodule seems to have some problems with VMware that I can't load the kernel module and dmesg
outputs that pfc: ERROR: Processor does not have Perfmon and Debug Capability!
. It's super weird.
Anyway, uarch is an awesome benchmark. Thank you so much for open source.
It turns out that
pmu-tools/event_download.py
didn't work properly and thus files were missing. It can be fixed by justsudo make
again. (I don't know why I missed the error message.)
Ah OK. So does --timer=perf
work after the events are downloaded? BTW, you shouldn't need sudo
to run make for this project, although I suppose you can if you want (I haven't tested that scenario, and I assume it might do weird things like write the event files to the $HOME directory for root user). I guess if you are running uarch-bench itself using sudo
then you'd want to run make
under sudo
too so the files end in the right place.
In general I'm not really happy with this whole event file downloading thing: it's inherited from the jevents library I used. I'd prefer instead to have the files checked in or compiled directly into the binary even though it would mean that I have to periodically update them. I'll need to do something like that to support AMD anyway.
Besides, VMware can virtualize the CPU counters and
perf
works
Ah nice. Despite what I said earlier, several VMs may also allow counter access, but it may not be on by default or something. I suppose the hypervisor needs to virtualize this by switching around the counter configuration, saving values and so on, every time the guest changes. To do it right you need a pretty comprehensive view of all the possible MSRs and configs, and it has to be kept to date, so it doesn't seem trivial.
I can't load the kernel module and
dmesg
outputs thatpfc: ERROR: Processor does not have Perfmon and Debug Capability!
. It's super weird.
Huh, that error message occurs when a couple of perf related cpuid
checks fail: one for having perf monitoring at all, and one for full-width rights. I guess VMWare is not reporting one of those two things. In any case, I don't think pfc
offers much above --timer=perf
here and the latter has a lot that pfc
doesn't have. PFC is kind of obsolete in that sense: it's what I used first and I keep it in "just because", but I rarely use it (could be useful on some old kernels with poor perf_events
support or as a way to double-check perf).