From: Ingo Molnar One frequent sign of IRQ handling bugs is the appearance of unexpected vectors. Print out all the IRQ state in that case. We dont want this patch upstream, but it is useful during initial testing. Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner Signed-off-by: Andrew Morton --- kernel/irq/handle.c | 2 + kernel/irq/internals.h | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff -puN kernel/irq/handle.c~genirq-more-verbose-debugging-on-unexpected-irq-vectors kernel/irq/handle.c --- devel/kernel/irq/handle.c~genirq-more-verbose-debugging-on-unexpected-irq-vectors 2006-05-29 16:21:38.000000000 -0700 +++ devel-akpm/kernel/irq/handle.c 2006-05-29 16:46:29.000000000 -0700 @@ -24,6 +24,7 @@ void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs) { + print_irq_desc(irq, desc); kstat_this_cpu.irqs[irq]++; ack_bad_irq(irq); } @@ -61,6 +62,7 @@ struct irq_desc irq_desc[NR_IRQS] __cach */ static void ack_bad(unsigned int irq) { + print_irq_desc(irq, irq_desc + irq); ack_bad_irq(irq); } diff -puN kernel/irq/internals.h~genirq-more-verbose-debugging-on-unexpected-irq-vectors kernel/irq/internals.h --- devel/kernel/irq/internals.h~genirq-more-verbose-debugging-on-unexpected-irq-vectors 2006-05-29 16:21:38.000000000 -0700 +++ devel-akpm/kernel/irq/internals.h 2006-05-29 16:21:38.000000000 -0700 @@ -22,3 +22,43 @@ static inline void unregister_handler_pr struct irqaction *action) { } #endif +/* + * Debugging printout: + */ + +#include + +#define P(f) if (desc->status & f) printk("%14s set\n", #f) + +static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) +{ + printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n", + irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled); + printk("->handle_irq(): %p, ", desc->handle_irq); + print_symbol("%s\n", (unsigned long)desc->handle_irq); + printk("->chip(): %p, ", desc->chip); + print_symbol("%s\n", (unsigned long)desc->chip); + printk("->action(): %p\n", desc->action); + if (desc->action) { + printk("->action->handler(): %p, ", desc->action->handler); + print_symbol("%s\n", (unsigned long)desc->action->handler); + } + + P(IRQ_INPROGRESS); + P(IRQ_DISABLED); + P(IRQ_PENDING); + P(IRQ_REPLAY); + P(IRQ_AUTODETECT); + P(IRQ_WAITING); + P(IRQ_LEVEL); + P(IRQ_MASKED); +#ifdef CONFIG_IRQ_PER_CPU + P(IRQ_PER_CPU); +#endif + P(IRQ_NOPROBE); + P(IRQ_NOREQUEST); + P(IRQ_NOAUTOEN); +} + +#undef P + _