Open simonhf opened 1 year ago
Hmmm..... AMD does not support the Intel "trick" of using RDPMC with performance counter numbers (1<<30)+[0123] to access the fixed-function performance counters. AMD does appear to support the same fixed-function counters, but only via the MSR interfaces (which can only be accessed in kernel mode, so don't qualify as "low overhead" counters from user space).
Fixing this is going to take a modest amount of work -- the three functions rdpmc_instructions, rdpmc_actual_cycles, and rdpmc_reference cycles will have to be removed for an AMD version. The harder part will be going through the CPUID-based routines and trying to figure out if alternative functionality is available in the AMD processors.
Hmmm..... AMD does not support the Intel "trick" of using RDPMC with performance counter numbers (1<<30)+[0123] to access the fixed-function performance counters. AMD does appear to support the same fixed-function counters, but only via the MSR interfaces (which can only be accessed in kernel mode, so don't qualify as "low overhead" counters from user space).
Interesting. Do you have any reference for this? Seems like a pretty big limitation.
The "AMD64 Architecture Programmer's Manual. Volume 3 General Purpose and System Instructions" (document 24594, revision 3.35, June 2023),section on the RDPMC instructio:n has a table listing the allowed counter numbers. Counters 0-5 are core counters, 6-9 are Northbridge counters, 10-15 are L3 counters, and 16-27 are additional Northbridge counters. Values > 27 are reserved.
It makes me very happy that the L3 and Northbridge counters are accessible using RDPMC, but there is no indication that the "fixed function" performance counters can be accessed this way.