Skip to contentSkip to conversation

irq: Guard handle_bad_irq log messages

PATCH Superseded Guenter Roeck 2 participants 3 messages Dec 2, 2017 IRQ

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irq: Guard handle_bad_irq log messages

An interrupt storm on a bad interrupt will cause the kernel log to be clogged.

[   60.089234] ->handle_irq():  ffffffffbe2f803f,
[   60.090455] 0xffffffffbf2af380
[   60.090510] handle_bad_irq+0x0/0x2e5
[   60.090522] ->irq_data.chip(): ffffffffbf2af380,
[   60.090553]    IRQ_NOPROBE set
[   60.090584] ->handle_irq():  ffffffffbe2f803f,
[   60.090590] handle_bad_irq+0x0/0x2e5
[   60.090596] ->irq_data.chip(): ffffffffbf2af380,
[   60.090602] 0xffffffffbf2af380
[   60.090608] ->action():           (null)
[   60.090779] handle_bad_irq+0x0/0x2e5

This was seen when running an upstream kernel on Acer Chromebook R11. The system was unstable as result.

Guard the log message with __printk_ratelimit to reduce the impact. This won't prevent the interrupt storm from happening, but at least the system remains stable.

---
 kernel/irq/handle.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/irq/handle.c +3 -1
index 79f987b942b8..ad4d7a995f18 100644
@@ -28,9 +28,11 @@
  */
 void handle_bad_irq(struct irq_desc *desc)
 {
+	static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
 	unsigned int irq = irq_desc_get_irq(desc);
 
-	print_irq_desc(irq, desc);
+	if (__ratelimit(&ratelimit))
+		print_irq_desc(irq, desc);
 	kstat_incr_irqs_this_cpu(desc);
 	ack_bad_irq(irq);
 }
Signature · 1 line
2.7.4
#1 lore raw
Quoted 15 lines · Guenter Roeck

An interrupt storm on a bad interrupt will cause the kernel log to be clogged.

[   60.089234] ->handle_irq():  ffffffffbe2f803f,
[   60.090455] 0xffffffffbf2af380
[   60.090510] handle_bad_irq+0x0/0x2e5
[   60.090522] ->irq_data.chip(): ffffffffbf2af380,
[   60.090553]    IRQ_NOPROBE set
[   60.090584] ->handle_irq():  ffffffffbe2f803f,
[   60.090590] handle_bad_irq+0x0/0x2e5
[   60.090596] ->irq_data.chip(): ffffffffbf2af380,
[   60.090602] 0xffffffffbf2af380
[   60.090608] ->action():           (null)
[   60.090779] handle_bad_irq+0x0/0x2e5
Quoted 6 lines

This was seen when running an upstream kernel on Acer Chromebook R11. The system was unstable as result.

Guard the log message with __printk_ratelimit to reduce the impact. This won't prevent the interrupt storm from happening, but at least the system remains stable.

Thanks.

There is also dummychip.c

Perhaps this should be updated in the
static inline in kernel/irq/debug.h instead.

kernel/irq/handle.c

Quoted 1 line
kernel/irq/handle.c +0 -0

[]

Quoted 13 lines
kernel/irq/handle.c +3 -1
@@ -28,9 +28,11 @@
  */
 void handle_bad_irq(struct irq_desc *desc)
 {
+	static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
 	unsigned int irq = irq_desc_get_irq(desc);
 
-	print_irq_desc(irq, desc);
+	if (__ratelimit(&ratelimit))
+		print_irq_desc(irq, desc);
 	kstat_incr_irqs_this_cpu(desc);
 	ack_bad_irq(irq);
 }
#2 lore raw
Quoted 23 lines · Joe Perches
Quoted 15 lines · Guenter Roeck

An interrupt storm on a bad interrupt will cause the kernel log to be clogged.

[   60.089234] ->handle_irq():  ffffffffbe2f803f,
[   60.090455] 0xffffffffbf2af380
[   60.090510] handle_bad_irq+0x0/0x2e5
[   60.090522] ->irq_data.chip(): ffffffffbf2af380,
[   60.090553]    IRQ_NOPROBE set
[   60.090584] ->handle_irq():  ffffffffbe2f803f,
[   60.090590] handle_bad_irq+0x0/0x2e5
[   60.090596] ->irq_data.chip(): ffffffffbf2af380,
[   60.090602] 0xffffffffbf2af380
[   60.090608] ->action():           (null)
[   60.090779] handle_bad_irq+0x0/0x2e5
Quoted 6 lines

This was seen when running an upstream kernel on Acer Chromebook R11. The system was unstable as result.

Guard the log message with __printk_ratelimit to reduce the impact. This won't prevent the interrupt storm from happening, but at least the system remains stable.

Quoted 7 lines

Thanks.

There is also dummychip.c

Perhaps this should be updated in the
static inline in kernel/irq/debug.h instead.

Agreed, makes sense. I'll send an updated patch.

Guenter

Quoted 16 lines

kernel/irq/handle.c

Quoted 1 line
kernel/irq/handle.c +0 -0

[]

Quoted 13 lines
kernel/irq/handle.c +3 -1
@@ -28,9 +28,11 @@
   */
  void handle_bad_irq(struct irq_desc *desc)
  {
+	static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
  	unsigned int irq = irq_desc_get_irq(desc);
 
-	print_irq_desc(irq, desc);
+	if (__ratelimit(&ratelimit))
+		print_irq_desc(irq, desc);
  	kstat_incr_irqs_this_cpu(desc);
  	ack_bad_irq(irq);
  }