Skip to contentSkip to conversation

x86/mce: Restore rate limit on MCE logged message

PATCH In review Rik van Riel 5 participants 10 messages Nov 8 – Nov 11

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mce: Restore rate limit on MCE logged message

FCommit ea324444ece9f moved the "Machine check events logged" print from mce_notify_irq() into mce_log() and dropped its two-per-minute rate limit as a side effect.

A particularly unhappy system can spew out around 100 million of those "Machine check events logged" messages every hour, without that rate limit. A large fleet may have several unhappy systems, leaving the netcons infrastructure somewhat flustered.

Reinstate the rate limit we had before.

Fixes ea324444ece9f ("x86/mce: Restore MCA polling interval halving")
---
 arch/x86/kernel/cpu/mce/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mce/core.c +5 -1
index 50b1614968be..06f858faf2b1 100644
@@ -150,8 +150,12 @@ EXPORT_PER_CPU_SYMBOL_GPL(injectm);
 
 void mce_log(struct mce_hw_err *err)
 {
+	/* Not more than two messages every minute */
+	static DEFINE_RATELIMIT_STATE(ratelimit, 60*HZ, 2);
+
 	if (mce_gen_pool_add(err)) {
-		pr_info(HW_ERR "Machine check events logged\n");
+		if (__ratelimit(&ratelimit))
+			pr_info(HW_ERR "Machine check events logged\n");
 		irq_work_queue(&mce_irq_work);
 	}
 }
Signature · 1 line
2.56.0
maintainer
#1 lore raw
Quoted 8 lines · Rik van Riel

FCommit ea324444ece9f moved the "Machine check events logged" print from mce_notify_irq() into mce_log() and dropped its two-per-minute rate limit as a side effect.

A particularly unhappy system can spew out around 100 million of those "Machine check events logged" messages every hour, without that rate limit. A large fleet may have several unhappy systems, leaving the netcons infrastructure somewhat flustered.

I need more info here. How are you running those systems?

Usually, correctable errors are consumed by the CEC and you don't see anything. So you must be doing something else.

.config and dmesg pls.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
maintainer Reviewed-by
#2 lore raw
Quoted 2 lines

Usually, correctable errors are consumed by the CEC and you don't see anything. So you must be doing something else.

mce_log() is called from the interrupt. CEC is called later because it registered with mce_register_decode_chain() to be told about errors that were added to the queue by mce_gen_pool_add().

So the message goes out to the console before CEC has a chance to squash reporting of corrected errors.

Change looks good to me:

-Tony

maintainer
#3 lore raw
Quoted 1 line · Tony

mce_log() is called from the interrupt.

Aha, through machine_check_poll(). Let's hear from Rik first tho.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#4 lore raw
Quoted 4 lines · Borislav Petkov
Quoted 1 line · Tony

mce_log() is called from the interrupt.

Aha, through machine_check_poll(). Let's hear from Rik first tho.

Not only the poll path, but also the #MC exception handler.

exc_machine_check
--> exc_machine_check_{kernel,user}

      --> do_machine_check
          --> mce_log
              --> pr_info("Machine check events logged")

As for the dmesg, it is almost entirely filled with "Machine check events logged" errors, at a rate of about 100 million an hour.

There are a dozen or so "mce: MCE records pool full!" lines, and then two of these:
"mce_gen_pool_add: <bignum> callbacks suppressed"

I suspect there isn't anything special about the kernel here, we are just looking at some unusually broken hardware, which will be present in a fleet this size.

Signature · 1 line
All Rights Reversed.
maintainer
#5 lore raw
Quoted 3 lines · Rik van Riel

There are a dozen or so "mce: MCE records pool full!" lines, and then two of these:
"mce_gen_pool_add: <bignum> callbacks suppressed"

Sounds to me like you getting errors logged and there's no userspace consumer at all.

What is your fleet policy about collecting and logging hw errors?

Do you even care about them?

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#6 lore raw
Quoted 5 lines · Borislav Petkov
Quoted 3 lines · Rik van Riel

There are a dozen or so "mce: MCE records pool full!" lines, and then two of these:
"mce_gen_pool_add: <bignum> callbacks suppressed"

Quoted 7 lines

Sounds to me like you getting errors logged and there's no userspace consumer
at all.

What is your fleet policy about collecting and logging hw errors?

Do you even care about them?

We definitely care about them. Errors are used to figure out which hosts need to be repaired.

I do not know how exactly memory errors are getting collected. There are some tools that watch netcons, some that collect data on the host, and some that grab data off the BMC. I have no idea which of those paths the memory error collection uses.

Signature · 1 line
All Rights Reversed.
maintainer
#7 lore raw
Quoted 5 lines · Rik van Riel

I do not know how exactly memory errors are getting collected. There are some tools that watch netcons, some that collect data on the host, and some that grab data off the BMC. I have no idea which of those paths the memory error collection uses.

It probably doesn't matter for the problem at hand - I guess we should ratelimit that printk after all...

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Reviewed-by
#8 lore raw
Quoted 14 lines

From: Borislav Petkov <[email protected]>
Sent: Tuesday, November 10, 2026 5:49 AM
To: Rik van Riel <[email protected]>
Cc: Luck, Tony <[email protected]>; Thomas Gleixner <[email protected]>; Ingo Molnar <[email protected]>; Dave Hansen <[email protected]>; [email protected]; H. Peter Anvin <[email protected]>; Qiuxu Zhuo <[email protected]>; [email protected]; linux- [email protected]; [email protected]; Breno Leitao <[email protected]>
Subject: Re: [PATCH] x86/mce: Restore rate limit on MCE logged message

External email: Use caution opening links or attachments

Quoted 9 lines
Quoted 4 lines · Rik van Riel

I do not know how exactly memory errors are getting collected. There are some tools that watch netcons, some that collect data on the host, and some that grab data off the BMC. I have no idea which of those paths the memory error collection uses.

It probably doesn't matter for the problem at hand - I guess we should ratelimit that printk after all...

This commit restores the rate limit removed by commit

    ea324444ece9 ("x86/mce: Restore MCA polling interval halving").

Sorry I missed that removal during my review :-)

Restoring it looks good to me.

Reviewed-by on v1 1/1
#9 lore raw
In reply to Rik van Riel
Quoted 9 lines · Rik van Riel

FCommit ea324444ece9f moved the "Machine check events logged" print from mce_notify_irq() into mce_log() and dropped its two-per-minute rate limit as a side effect.

A particularly unhappy system can spew out around 100 million of those "Machine check events logged" messages every hour, without that rate limit. A large fleet may have several unhappy systems, leaving the netcons infrastructure somewhat flustered.

Quoted 5 lines

Reinstate the rate limit we had before.

Fixes ea324444ece9f ("x86/mce: Restore MCA polling interval halving")