Re: [PATCH] perf/x86/amd: Do not WARN on every IRQ

From: Peter Zijlstra
Date: Fri Jun 16 2023 - 09:30:30 EST


On Fri, Jun 16, 2023 at 04:53:15AM -0700, Breno Leitao wrote:
> On some systems, the Performance Counter Global Status Register is
> coming with reserved bits set, which causes the system to be unusable
> if a simple `perf top` runs. The system hits the WARN() thousands times
> while perf runs.
>
> WARNING: CPU: 18 PID: 20608 at arch/x86/events/amd/core.c:944 amd_pmu_v2_handle_irq+0x1be/0x2b0
>
> This happens because the "Performance Counter Global Status Register"
> (PerfCntGlobalStatus) MSR has bit 7 set. Bit 7 should be reserved according
> to the documentation (Figure 13-12 from "AMD64 Architecture Programmer’s
> Manual, Volume 2: System Programming, 24593"[1]

Would it then not make more sense to mask out bit7 before:

+ status &= ~AMD_PMU_V2_GLOBAL_STATUS_RESERVED;
if (!status)
goto done;

?

Aside from being reserved, why are these bits magically set all of a
sudden?