[PATCH v3 1/2] x86/mce: Reset MCA_SYND between bank scans

From: OptoCloud

Date: Mon Sep 21 2026 - 10:01:08 EST


From: Eirik Bøe <git@xxxxxxxxxxxx>

machine_check_poll() and __mc_scan_banks() both reuse a single
struct mce_hw_err while iterating over the MCA banks. The record is
zeroed once before the loop. Each iteration then resets only MISC
and ADDR.

On SMCA, mce_read_aux() writes SYND only when MCI_STATUS_SYNDV is
set. Nothing clears it again, so a bank that does not set SYNDV
inherits the SYND value read for the previous bank in the same
scan, and that stale value is printed and handed to the decoders as
if it belonged to the current error.

Decoders are expected to ignore MCA_SYND when SYNDV is clear, so
the stale value is cosmetic.

Reset SYND at the start of each iteration in both loops, alongside
the existing MISC and ADDR resets.

Found by code inspection; not reproduced on hardware.

Fixes: db819d60f672 ("x86/mce: Add support for new MCA_SYND register")
Signed-off-by: Eirik Bøe <git@xxxxxxxxxxxx>
Reviewed-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
---

Notes (amlog):
No v2 of this patch was sent. The numbering follows the series.

Changes since v1:
- Dropped Cc: stable (Yazen)
- Picked up Yazen's Reviewed-by

arch/x86/kernel/cpu/mce/core.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index ab469605fc89..16183fa4ddc7 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -808,6 +808,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)

m->misc = 0;
m->addr = 0;
+ m->synd = 0;
m->bank = i;

barrier();
@@ -1347,6 +1348,7 @@ __mc_scan_banks(struct mce_hw_err *err, struct pt_regs *regs,

m->misc = 0;
m->addr = 0;
+ m->synd = 0;
m->bank = i;

m->status = mce_rdmsrq(mca_msr_reg(i, MCA_STATUS));
--
2.55.0

Cheers,
Eirik Bøe