[PATCH v2 0/3] Increase MCA bank count

From: Yazen Ghannam

Date: Mon Nov 23 2026 - 18:27:32 EST


Hi all,

This set increases the max MCA bank count (MAX_NR_BANKS) to the
architectural limit.

Patch 1 is a bug fix that came out of code review.

Patch 2 is a pre-patch to avoid a bug for systems with more than 64 MCA
banks per thread.

Patch 3 is where MAX_NR_BANKS is updated. The commit message includes
some memory stats like the last time we bumped up MAX_NR_BANKS.

Originally, I intended to include additional patches to consolidate and
dynamically allocate many of the per-CPU and per-bank structures. These
still need more work. So I thought to send just this small set to start.

Also, I figure a smaller set would be easier for backporting for those
who want the feature support but don't want the additional rework.

I'm trying to see if the per-CPU rework can help with the "sysfs
hotplug" issues reported by syzbot. I'll send rework as a follow up to
this series.

Testing was done in a KVM guest with a locally patched QEMU that
emulates SMCA banks, at 255, 65, 64 and 1 banks per thread, and on AMD
EPYC server systems. Mainline fails at more than 64 banks. Without
patch 2, banks 64-127 alias to banks 0-63 for thresholding.

An LLM coding assistant was used to help draft and revise the commit
messages, to measure the size changes listed in patch 3, and to write
and run the tests above. All code and text were reviewed by me.

I had the measurement data included in patch 3 similar to how we did the
last time MAX_NR_BANKS got bumped up. Ofc, we can trim this if it's too
much.

Thanks,
Yazen

Changes in v2:
- Rebase on v7.4-rc4.
- Patch 1: Split the bank bound check into its own early return. (Boris)
- Patch 1: Note in the commit message that GHES records are affected
too, and that an out-of-range bank makes the address not usable.
- Patch 3: Explain the cmci_supported() change in the commit message.
- Patch 3: Add the #MC stack frame and intel-bff.o size changes.
- Drop the Assisted-by trailers. Tool use is described above, following
1e035297ffda ("docs: remove Assisted-by references").

v1: https://lore.kernel.org/r/20260903142049.4126599-1-yazen.ghannam@xxxxxxx

Yazen Ghannam (3):
x86/mce/amd: Fix bank lookup in amd_mce_usable_address()
x86/mce/amd: Convert bank_map to a bitmap
x86/mce: Increase MAX_NR_BANKS to 255

arch/x86/include/asm/mce.h | 2 +-
arch/x86/kernel/cpu/mce/amd.c | 11 +++++++----
arch/x86/kernel/cpu/mce/core.c | 6 ------
arch/x86/kernel/cpu/mce/intel.c | 2 +-
4 files changed, 9 insertions(+), 12 deletions(-)


base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
--
2.55.0