[PATCH] x86: ratelimit NMI messages

From: Robert Richter
Date: Thu Aug 05 2010 - 12:04:31 EST


In case of a storm of unknown NMIs the cpu get stucked. This patch
adds ratelimits to avoid this.

Signed-off-by: Robert Richter <robert.richter@xxxxxxx>
---
arch/x86/kernel/traps.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 60788de..97a492d 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -366,15 +366,17 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
return;
}
#endif
- printk(KERN_EMERG
- "Uhhuh. NMI received for unknown reason %02x on CPU %d.\n",
- reason, smp_processor_id());
-
- printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n");
+ if (printk_ratelimit()) {
+ printk(KERN_EMERG "Uhhuh. NMI received for unknown reason"
+ " %02x on CPU %d.\n", reason, smp_processor_id());
+ printk(KERN_EMERG
+ "Do you have a strange power saving mode enabled?\n");
+ }
if (panic_on_unrecovered_nmi)
panic("NMI: Not continuing");
-
- printk(KERN_EMERG "Dazed and confused, but trying to continue\n");
+ if (printk_ratelimit())
+ printk(KERN_EMERG
+ "Dazed and confused, but trying to continue\n");
}

static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
--
1.7.1.1



--
Advanced Micro Devices, Inc.
Operating System Research Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/