Re: [PATCH] x86/mce: Restore MCA polling interval halving

Nikolay Borisov
2026-04-07T12:51:34Z

On 7.04.26 г. 1:49 ч., Borislav Petkov wrote:
> Ok,
>
> finally. :-\
>
> Pls run it to make sure it DTRT for you too.
>
> Thx.
>
> ---
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
> Date: Mon, 16 Mar 2026 16:12:00 +0100
> Subject: [PATCH] x86/mce: Restore MCA polling interval halving
>
> RongQing reported that the MCA polling interval doesn't halve when an
> error gets logged. It was traced down to the commit in Fixes: because:
>
> mce_timer_fn()
> |-> mce_poll_banks()
> |-> machine_check_poll()
> |-> mce_log()
>
> which will queue the work and return.
>
> Now, back in mce_timer_fn():
>
> /*
> * Alert userspace if needed. If we logged an MCE, reduce the polling
> * interval, otherwise increase the polling interval.
> */
> if (mce_notify_irq())
>
> <--- here we haven't ran the notifier chain yet so mce_need_notify is
> not set yet so this won't hit and we won't halve the interval iv.
>
> Now the notifier chain runs. mce_early_notifier() sets the bit, does
> mce_notify_irq(), that clears the bit and then the notifier chain
> a little later logs the error.
>
> So this is a silly timing issue.
>
> But, that's all unnecessary.
>
> All it needs to happen here is, the "should we notify of a logged MCE"
> mce_notify_irq() asks, should be simply a question to the mce gen pool:
> "Are you empty?"
>
> And that then turns into a simple yes or no answer and it all
> JustWorks(tm).
>
> So do that.
>
> Fixes: 011d82611172 ("RAS: Add a Corrected Errors Collector")
> Reported-by: Li RongQing <lirongqing@baidu.com>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> Link: https://lore.kernel.org/r/20260112082747.2842-1-lirongqing@baidu.com

Much cleaner and simpler,

Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>