Re: [PATCH v4 2/4] perf/x86/amd/core: Handle overflows of counters stopped by a throttle
From: Ravi Bangoria
Date: Thu Dec 03 2026 - 08:43:25 EST
> Since commit 9734e25fbf5a ("perf: Fix the throttle logic for a group")
> a throttle stops the whole event group. perf_event_overflow() can
> therefore stop counters which the NMI handler has not reached yet.
>
> amd_pmu_v2_handle_irq() tests cpuc->active_mask while it walks the
> counters. It skips a sibling which was stopped that way, also when the
> sibling has overflowed in the same NMI. The overflow is not handled,
> the status bit stays set and the handler warns:
>
> New overflows for inactive PMCs: 2
> WARNING: arch/x86/events/amd/core.c:1031 at amd_pmu_v2_handle_irq+0x86e/0x9a0
>
> An unprivileged task can trigger this with perf_event_paranoid at its
> default of 2: a group of two sampling events with short periods on the
> task itself, which spins in user space.
>
> Take a copy of active_mask before the loop and walk the counters which
> were active on entry. The overflow of a counter which was stopped in
> the meantime is then handled like any other.
>
> The problem was found with syzkaller. An AI coding assistant (Claude
> Code) was used in the analysis and in writing the reproducer and the
> patch.
>
> Fixes: 9734e25fbf5a ("perf: Fix the throttle logic for a group")
> Signed-off-by: Oancea Catalin <john3@xxxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
Reviewed-by: Ravi Bangoria <ravi.bangoria@xxxxxxx>
Thanks,
Ravi