What HW feature does perf
use to collect performance monitoring event for ring 0 on Intel CPUs?
My picture of the world is this:
- Looking for a free
IA32_PERFEVTSELn
MSR by askingIA32_PERF_GLOBAL_INUSE
- When taking a free
IA32_PERFEVTSELn
it sets the dedicated bit for a particular counter that is being programmed for the MSR as depicted in the Intel Documentation, Vol.3.
Having said that either ring 0 or ring 3 or both are the only possible scenarios.