[PATCH v4 0/5] Handle corrected machine check interrupt storms

From: Tony Luck
Date: Mon Apr 03 2023 - 17:07:36 EST


Linux CMCI storm mitigation is a big hammer that just disables the CMCI
interrupt globally and switches to polling all banks.

There are two problems with this:
1) It really is a big hammer. It means that errors reported in other
banks from different functional units are all subject to the same
polling delay before being processed.
2) Intel systems signal some uncorrected errors using CMCI (e.g.
memory controller patrol scrub on Icelake Xeon and newer). Delaying
processing these error reports negates some of the benefit of the patrol
scrubber providing early notice of errors before they are consumed and
cause a machine check.

This series throws away the old storm implementation and replaces it
with one that keeps track of the weather on each separate machine check
bank. When a storm is detected from a bank. On Intel the storm is
mitigated by setting a very high threshold for corrected errors to
signal CMCI. This threshold does not affect signaling CMCI for
uncorrected errors.

AMD's storm mitigation for threshold interrupts also relies on per CPU
per bank approach similar to Intel. But unlike CMCI storm handling it does
not set thresholds to reduce rate of interrupts on a storm. Rather it
turns off the interrupt on the current CPU and bank if there is a storm
and re-enables back the interrupts when the storm subsides.

It is okay to turn off threshold interrupts on AMD systems as other error
severities continue to be handled even if the threshold interrupts are
turned off. Uncorrected errors will generate a #MC and deferred errors
have a unique separate deferred error interrupt. The final patch adds
support for handling threshold interrupt storms on AMD systems.

Changes since last version:

Yazen:
Reported inverted tests in two places that cancelled each other
out so the code worked. But the logic was backwards.
Provided Tested-by and Reviewed-by tags


Smita Koralahalli (3):
x86/mce: Introduce mce_handle_storm() to deal with begin/end of storms
x86/mce: Move storm handling to core.
x86/mce: Handle AMD threshold interrupt storms

Tony Luck (2):
x86/mce: Remove old CMCI storm mitigation code
x86/mce: Add per-bank CMCI storm mitigation

arch/x86/kernel/cpu/mce/internal.h | 33 ++++--
arch/x86/kernel/cpu/mce/amd.c | 49 ++++++++
arch/x86/kernel/cpu/mce/core.c | 139 +++++++++++++++++-----
arch/x86/kernel/cpu/mce/intel.c | 179 +++++++----------------------
4 files changed, 230 insertions(+), 170 deletions(-)


base-commit: 7e364e56293bb98cae1b55fd835f5991c4e96e7d
--
2.39.2