libpfc icon indicating copy to clipboard operation
libpfc copied to clipboard

ERROR: Unsupported performance monitoring architecture version 5, only 3 or 4 supported!

Open SurenNihalani opened this issue 7 months ago • 2 comments

Hey, I'm unable to use this:

[253635.966192] pfc: Kernel Module loading on processor Intel(R) Core(TM) i7-14700 (Family 6 (6), Model 183 (0B7), Stepping 1 (1))
[253635.966200] pfc: cpuid.0x0.0x0:        EAX=00000020, EBX=756e6547, ECX=6c65746e, EDX=49656e69
[253635.966202] pfc: cpuid.0x1.0x0:        EAX=000b0671, EBX=01800800, ECX=7ffafbff, EDX=bfebfbff
[253635.966203] pfc: cpuid.0x6.0x0:        EAX=00dfcff7, EBX=00000002, ECX=00000409, EDX=00000003
[253635.966205] pfc: cpuid.0xA.0x0:        EAX=07300605, EBX=00000000, ECX=00000007, EDX=00008603
[253635.966207] pfc: cpuid.0x80000000.0x0: EAX=80000008, EBX=00000000, ECX=00000000, EDX=00000000
[253635.966208] pfc: cpuid.0x80000001.0x0: EAX=00000000, EBX=00000000, ECX=00000121, EDX=2c100800
[253635.966209] pfc: cpuid.0x80000002.0x0: EAX=65746e49, EBX=2952286c, ECX=726f4320, EDX=4d542865
[253635.966210] pfc: cpuid.0x80000003.0x0: EAX=37692029, EBX=3734312d, ECX=00003030, EDX=00000000
[253635.966212] pfc: cpuid.0x80000004.0x0: EAX=00000000, EBX=00000000, ECX=00000000, EDX=00000000
[253635.966213] pfc: ERROR: Unsupported performance monitoring architecture version 5, only 3 or 4 supported!
[253635.966214] pfc: ERROR: Failed to load module pfc.

how can I fix this?

SurenNihalani avatar May 29 '25 21:05 SurenNihalani

@SurenNihalani You would edit here to set the check to if(pmcArchVer < 3 || pmcArchVer > 6){ and allow the code to proceed further, since according to the Intel SDM performance monitoring architecture 5 and 6 are compatible to 3 and 4.

However, I do wish to warn you that this library, although it is a self-contained example of a library and kernel module talking to each other, has lost its purpose somewhat due to changes within the Linux kernel that interfere with what it tries to do. There was discussion of this in a previous issue but to simplify, the kernel wants to lock down the performance monitoring stuff for security reasons. Extreme high precision counters are super useful to exploit Spectre-type side-channel vulnerabilities. I can't fight all of Linux with a kernel module that goes against all that kernel wants.

I leave the code up in public as a sort of "this is how it could be done", but I haven't made changes here in years, because it cannot serve its purpose well anymore, through no particular fault of its own. And it was never a very convenient library to use.

obilaniu avatar May 29 '25 22:05 obilaniu

@obilaniu I remember studying the code of this library 10 years ago to implement PMCs support in an x86 OS and then accurately evaluate some benchmarks. It worked very well for what I needed at the time, so here's my heartfelt thanks ❤.

Theldus avatar May 30 '25 01:05 Theldus