[PATCH v2 2/2] x86/mce: Avoid arming periodic polling timer when not required
From: Aaron Tomlin
Date: Tue Sep 01 2026 - 22:04:48 EST
On x86 platforms, the Machine Check Architecture (MCA) subsystem arms a
per-CPU, pinned standard timer (mce_timer) to periodically poll hardware
banks for "silent" corrected machine check errors. Because mce_timer is
pinned to the local CPU via TIMER_PINNED, the timer core cannot migrate
its expiration to a housekeeping CPU, causing periodic latency jitter on
isolated cores.
On Intel systems supporting Corrected Machine Check Interrupt (CMCI),
hardware generates an interrupt for banks with CMCI enabled, clearing
their respective bits in mce_poll_banks. However, for banks where
MCI_CTL2_CMCI_EN does not stick (such as the Power Control Unit bank),
Linux historically assumed software polling was required and left the
bank flagged in mce_poll_banks.
Per the Intel SDM (Vol 3B, Section 18.5 "Corrected Machine Check Error
Interrupt"), if bit 30 of IA32_MCi_CTL2 is zero, no CMCI is available
for that bank and no corrected or Uncorrected No Action Required (UCNA)
errors will be reported on that bank. Therefore, polling such banks is
redundant and wasteful.
Clear non-CMCI banks from mce_poll_banks in cmci_claim_bank() on
CMCI-capable CPUs, and amend should_enable_timer() to:
1. Check bitmap_empty(mce_poll_banks) so that mce_timer is never
armed when no banks on that CPU require software polling.
2. Pin the MCE polling timer to a HK_TYPE_TIMER housekeeping CPU,
sparing isolated nohz_full cores from periodic wakeups on
systems requiring mce_poll_banks polling.
On modern CMCI-supported platforms, mce_timer is eliminated system-wide
in steady state. On legacy or polling-only configurations, housekeeping
CPUs perform routine polling whilst isolated CPUs remain jitter-free.
Polling fallback during active error storms is fully preserved.
Suggested-by: Tony Luck <tony.luck@xxxxxxxxx>
Signed-off-by: Aaron Tomlin <atomlin@xxxxxxxxxxx>
---
arch/x86/kernel/cpu/mce/core.c | 7 +++++++
arch/x86/kernel/cpu/mce/intel.c | 11 ++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 765e8103b0d2..7415d05076eb 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -25,6 +25,7 @@
#include <linux/delay.h>
#include <linux/ctype.h>
#include <linux/sched.h>
+#include <linux/sched/isolation.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/slab.h>
@@ -1759,6 +1760,12 @@ void (*mc_poll_banks)(void) = mc_poll_banks_default;
static bool should_enable_timer(unsigned long iv)
{
+ if (bitmap_empty(this_cpu_ptr(mce_poll_banks), MAX_NR_BANKS))
+ return false;
+
+ if (!housekeeping_cpu(smp_processor_id(), HK_TYPE_TIMER))
+ return false;
+
return !mca_cfg.ignore_ce && iv;
}
diff --git a/arch/x86/kernel/cpu/mce/intel.c b/arch/x86/kernel/cpu/mce/intel.c
index 4655223ba560..cc7d0dfcf9c7 100644
--- a/arch/x86/kernel/cpu/mce/intel.c
+++ b/arch/x86/kernel/cpu/mce/intel.c
@@ -229,16 +229,17 @@ static u64 cmci_pick_threshold(u64 val, int *bios_zero_thresh)
*/
static void cmci_claim_bank(int bank, u64 val, int bios_zero_thresh, int *bios_wrong_thresh)
{
- struct mca_storm_desc *storm = this_cpu_ptr(&storm_desc);
-
val |= MCI_CTL2_CMCI_EN;
wrmsrq(MSR_IA32_MCx_CTL2(bank), val);
rdmsrq(MSR_IA32_MCx_CTL2(bank), val);
- /* If the enable bit did not stick, this bank should be polled. */
+ /*
+ * If the enable bit did not stick, this bank does not support CMCI
+ * and no corrected or UCNA errors will be reported on this bank
+ * (SDM Vol 3B 18.5). No polling is needed.
+ */
if (!(val & MCI_CTL2_CMCI_EN)) {
- WARN_ON(!test_bit(bank, this_cpu_ptr(mce_poll_banks)));
- storm->banks[bank].poll_only = true;
+ __clear_bit(bank, this_cpu_ptr(mce_poll_banks));
return;
}
--
2.55.0