Re: [PATCH] x86/mce: Fix timer interval adjustment after logging a MCE event

Nikolay Borisov
2026-01-12T08:56:51Z

On 12.01.26 г. 10:27 ч., lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> Since commit 011d82611172 ("RAS: Add a Corrected Errors Collector"),
> mce_notify_irq() in should_enable_timer() always returns false even

should_enable_timer doesn't call mce_notify_irq

> when an MCE event is logged, because bit 0 of mce_need_notify is not
> set in mce_log. This prevents the timer interval from being properly
> adjusted.
>
> Fix this by modifying machine_check_poll() to return a boolean indicating
> whether an MCE was logged, and update mc_poll_banks() to propagate this
> return value. The timer interval logic in mce_timer_fn() now uses this
> return value directly instead of relying on mce_notify_irq().

This warrants a bit more explanation why it's correct. Because
mce_notify_irq is really a misnomer, it will ideally be named
mce_notify_user(). That function is called from 2 places:

1. Early notifier block, but there it's guaranteed to do the right thing
as mce_need_notify is explicitly set.

2. From the timer function, where as you have pointed out
mce_need_notify is never set by the polling code, hence the function is
a noop. But actually calling mce_log() processes all logged errors in
the gen pool and that is processed by calling the x86_mce_decoder_chain
which will DTRT w.r.t to mce_notify_irq since the early notifier will be
called from there.

<snip>