From: Aaron Tomlin <atomlin@atomlin.com>
To: tony.luck@intel.com, bp@alien8.de, tglx@kernel.org,
mingo@redhat.com, dave.hansen@linux.intel.com
Cc: x86@kernel.org, hpa@zytor.com, frederic@kernel.org,
marco.crivellari@suse.com, sean@ashe.io, chjohnst@gmail.com,
mproche@gmail.com, nick.lange@gmail.com,
linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 1/2] x86/mce: Do not reinitialise mce_timer structure on CPU restart
Date: Wed, 2 Sep 2026 21:39:32 -0400 [thread overview]
Message-ID: <20260903013933.172063-2-atomlin@atomlin.com> (raw)
In-Reply-To: <20260903013933.172063-1-atomlin@atomlin.com>
During early CPU initialisation, mcheck_cpu_init() invokes
__mcheck_cpu_setup_timer(), which initialises the per-CPU mce_timer
descriptor via timer_setup(t, mce_timer_fn, TIMER_PINNED).
However, __mcheck_cpu_init_timer() is also called at runtime during
sysfs reconfiguration (via mce_cpu_restart() and mce_enable_ce()),
redundantly re-initialising mce_timer with timer_setup().
This introduces a race condition against asynchronous CMCI interrupts.
When mce_restart() runs, it invokes mce_timer_delete_all() before
broadcasting an IPI to execute mce_cpu_restart() on all CPUs. If a
hardware CMCI interrupt fires on another CPU before the IPI is serviced,
the CMCI handler triggers storm tracking and arms mce_timer via
mce_timer_kick(true), enqueuing it in the active timer wheel.
When mce_cpu_restart() runs subsequently in IPI context,
__mcheck_cpu_init_timer() calls timer_setup(), which invokes
__init_timer() on the already-queued timer. This clears the timer's
internal list pointers (entry.next and entry.pprev) whilst it remains
linked in the active timer wheel bucket, causing linked list corruption,
softirq lockups, or kernel panics during timer expiration.
Fix this by removing the redundant timer_setup() call from
__mcheck_cpu_init_timer(). The timer is already initialised once during
CPU setup; runtime restart paths only need to arm it via
mce_start_timer().
Fixes: 26c3c283c5b0 ("x86: mce: Split timer init")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
---
arch/x86/kernel/cpu/mce/core.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index ab469605fc89..765e8103b0d2 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -2091,7 +2091,6 @@ static void __mcheck_cpu_init_timer(void)
{
struct timer_list *t = this_cpu_ptr(&mce_timer);
- timer_setup(t, mce_timer_fn, TIMER_PINNED);
mce_start_timer(t);
}
--
2.55.0
next prev parent reply other threads:[~2026-09-03 1:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 1:39 [PATCH v3 0/2] x86/mce: Fix timer list corruption and avoid redundant polling Aaron Tomlin
2026-09-03 1:39 ` Aaron Tomlin [this message]
2026-09-03 1:39 ` [PATCH v3 2/2] x86/mce: Avoid arming periodic polling timer when not required Aaron Tomlin
2026-09-03 3:37 ` Aaron Tomlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260903013933.172063-2-atomlin@atomlin.com \
--to=atomlin@atomlin.com \
--cc=bp@alien8.de \
--cc=chjohnst@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=frederic@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.crivellari@suse.com \
--cc=mingo@redhat.com \
--cc=mproche@gmail.com \
--cc=nick.lange@gmail.com \
--cc=sean@ashe.io \
--cc=tglx@kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®