linux/kernel/irq
Pavel Emelianov f72fa70760 [PATCH] Fix misrouted interrupts deadlocks
While testing kernel on machine with "irqpoll" option I've caught such a
lockup:

	__do_IRQ()
	   spin_lock(&desc->lock);
           desc->chip->ack(); /* IRQ is ACKed */
	note_interrupt()
	misrouted_irq()
	handle_IRQ_event()
           if (...)
	      local_irq_enable_in_hardirq();
	/* interrupts are enabled from now */
	...
	__do_IRQ() /* same IRQ we've started from */
	   spin_lock(&desc->lock); /* LOCKUP */

Looking at misrouted_irq() code I've found that a potential deadlock like
this can also take place:

1CPU:
__do_IRQ()
   spin_lock(&desc->lock); /* irq = A */
misrouted_irq()
   for (i = 1; i < NR_IRQS; i++) {
      spin_lock(&desc->lock); /* irq = B */
      if (desc->status & IRQ_INPROGRESS) {

2CPU:
__do_IRQ()
   spin_lock(&desc->lock); /* irq = B */
misrouted_irq()
   for (i = 1; i < NR_IRQS; i++) {
      spin_lock(&desc->lock); /* irq = A */
      if (desc->status & IRQ_INPROGRESS) {

As the second lock on both CPUs is taken before checking that this irq is
being handled in another processor this may cause a deadlock.  This issue
is only theoretical.

I propose the attached patch to fix booth problems: when trying to handle
misrouted IRQ active desc->lock may be unlocked.

Acked-by: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-11-13 07:40:43 -08:00
..
autoprobe.c [PATCH] genirq: add handle_bad_irq() 2006-06-29 10:26:24 -07:00
chip.c [PATCH] genirq: clean up irq-flow-type naming 2006-10-17 08:18:45 -07:00
handle.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
internals.h [PATCH] genirq: more verbose debugging on unexpected IRQ vectors 2006-06-29 10:26:25 -07:00
Makefile [PATCH] genirq: add irq-chip support 2006-06-29 10:26:24 -07:00
manage.c IRQ: Typedef the IRQ handler function type 2006-10-05 13:28:27 +01:00
migration.c [PATCH] genirq: irq: add moved_masked_irq 2006-10-04 07:55:26 -07:00
proc.c [PATCH] bitmap: parse input from kernel and user buffers 2006-10-11 11:14:22 -07:00
resend.c [PATCH] ixp4xxdefconfig arm fixes 2006-10-06 12:11:08 -07:00
spurious.c [PATCH] Fix misrouted interrupts deadlocks 2006-11-13 07:40:43 -08:00