I have written a kernel module which creates a performance counter via "perf_event_create_kernel_counter" API and then periodically reads its value.
My application works on Kernel version-4.0.9 (and prior revisions) but it doesn't work on Kernel version-4.1 (and later revisions).
Basically in the later revisions of Kernel, I am able to read only Software counters (e.g.
PERF_COUNT_SW_CPU_CYCLES) but none of the hardware counter (e.g.
More specifically, the hardware counter always reads zero in the kernel revision 4.1 and later.
Does anybody have an idea what might be causing this problem and how to fix it?