Marcos,
Lots of VM’s don’t virtualize the PMU… nearly all in fact. I believe VMware had an option to do it, but it may no longer be supported. Generally, one can use the PERF software events (like PERF_COUNT_SW_CPU_CLOCK) but that’s not really any different than using any of the normal SVR4 or POSIX timers.
My own personal attitude is that if anyone needed performance from the metal, they weren’t running in a VM. However, this does limit using PAPI in a teaching environment.
PAPI does work fine in containers however.
Phil