Re: [PATCH 2/2] x86/mce: Add mce=panic_on_ce_count to panic on a corrected error flood

"Luck, Tony" <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-edac,org.kernel.vger.linux-kernel
Message-ID <aoyt0bpXGQf1Y8GH@agluck-desk3>
On Fri, Aug 21, 2026 at 03:24:08AM -0700, Breno Leitao wrote:
> +/*
> + * A bank that keeps reporting corrected errors is repairing them faster than
> + * anything acts on it. Count them and let the admin put a ceiling on it.
> + */
> +void mce_track_ce_count(struct mce *mce)
> +{
> +	struct storm_bank *bank = &this_cpu_ptr(&storm_desc)->banks[mce->bank];
> +	int limit = READ_ONCE(mca_cfg.panic_on_ce_count);
> +
> +	if (limit <= 0)
> +		return;
> +
> +	if (!(mce->status & MCI_STATUS_VAL) || !mce_is_correctable(mce))
> +		return;
> +
> +	if (++bank->ce_count < (u64)limit)

If errors are happening faster than Linux can service CMCI interrupts,
then the corrected error count in bits {52:38} will be some number
bigger than "1".[*] You should add that number here, rather than simply
incrementing +bank->ce_count.

> +		return;
> +
> +	printk_deferred(KERN_EMERG "CPU%d BANK%d logged %llu corrected errors\n",
> +			smp_processor_id(), mce->bank, bank->ce_count);
> +	mce_panic("Too many corrected errors", NULL, NULL);
> +}
> +
>  void mce_track_storm(struct mce *mce)
>  {
>  	struct mca_storm_desc *storm = this_cpu_ptr(&storm_desc);
> 
> -- 
> 2.53.0-Meta

-Tony

[*] My personal record is several hundred. But that was on a debug
system that had been poked to signal an error on every cache access!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.