These counters are shared by several CPUs, a CCX in the case of L3. A
process-mode PMC is loaded on every CPU that runs a target thread, so two
CPUs can program the same counter. Without PerfMonV2, an INVARIANTS
kernel then panics with "Starting active PMC"; otherwise the counts are
wrong. No privilege is needed: on Zen 1-3, "pmcstat -P LLC_MISSES" is
enough. System sampling is accepted too, but no interrupt handler
checks these counters.
Refuse every mode but PMC_MODE_SC, as the RAPL, PERF and TSC classes do.
Two system-mode PMCs on CPUs that share a counter can still conflict;
that is left to userland, as before.
PR: 296001
Reported by: asomers
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif@amd.com>