2 * linux/kernel/irq/spurious.c
4 * Copyright (C) 1992, 1998-2004 Linus Torvalds, Ingo Molnar
6 * This file contains spurious interrupt handling.
10 #include <linux/module.h>
11 #include <linux/kallsyms.h>
12 #include <linux/interrupt.h>
15 * If 99,900 of the previous 100,000 interrupts have not been handled
16 * then assume that the IRQ is stuck in some manner. Drop a diagnostic
17 * and try to turn the IRQ off.
19 * (The other 100-of-100,000 interrupts may have been a correctly
20 * functioning device sharing an IRQ with the failing one)
22 * Called under desc->lock
26 __report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret)
28 struct irqaction *action;
30 if (action_ret != IRQ_HANDLED && action_ret != IRQ_NONE) {
31 printk(KERN_ERR "irq event %d: bogus return value %x\n",
34 printk(KERN_ERR "irq %d: nobody cared!\n", irq);
37 printk(KERN_ERR "handlers:\n");
38 action = desc->action;
40 printk(KERN_ERR "[<%p>]", action->handler);
42 (unsigned long)action->handler);
44 action = action->next;
48 void report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret)
50 static int count = 100;
54 __report_bad_irq(irq, desc, action_ret);
58 void note_interrupt(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret)
60 if (action_ret != IRQ_HANDLED) {
61 desc->irqs_unhandled++;
62 if (action_ret != IRQ_NONE)
63 report_bad_irq(irq, desc, action_ret);
67 if (desc->irq_count < 100000)
71 if (desc->irqs_unhandled > 99900) {
73 * The interrupt is stuck
75 __report_bad_irq(irq, desc, action_ret);
79 printk(KERN_EMERG "Disabling IRQ #%d\n", irq);
80 desc->status |= IRQ_DISABLED;
81 desc->handler->disable(irq);
83 desc->irqs_unhandled = 0;
88 int __init noirqdebug_setup(char *str)
91 printk(KERN_INFO "IRQ lockup detection disabled\n");
95 __setup("noirqdebug", noirqdebug_setup);