Re: [Patch v5 16/19] perf/x86: Activate back-to-back NMI detection for arch-PEBS induced NMIs

From: Peter Zijlstra
Date: Mon Dec 08 2025 - 03:51:07 EST


On Mon, Dec 08, 2025 at 02:46:44PM +0800, Mi, Dapeng wrote:

> This change only take effects for arch-PEBS. For the legacy PEBS, the
> "handled" would still be added 1 unconditionally even the *_drain_pebs()
> helpers always return 0.
>
>     /*
>      * PEBS overflow sets bit 62 in the global status register
>      */
>     if (__test_and_clear_bit(GLOBAL_STATUS_BUFFER_OVF_BIT, (unsigned long
> *)&status)) {
>         u64 pebs_enabled = cpuc->pebs_enabled;
>
>         handled++;
>         x86_pmu_handle_guest_pebs(regs, &data);
>         static_call(x86_pmu_drain_pebs)(regs, &data);
>

Oh gawd. Please don't do that. If you change the calling convention of
that function, please have it be used consistently.