linux/kernel/irq
Herbert Xu a98ce5c6fe Fix synchronize_irq races with IRQ handler
As it is some callers of synchronize_irq rely on memory barriers
to provide synchronisation against the IRQ handlers.  For example,
the tg3 driver does

	tp->irq_sync = 1;
	smp_mb();
	synchronize_irq();

and then in the IRQ handler:

	if (!tp->irq_sync)
		netif_rx_schedule(dev, &tp->napi);

Unfortunately memory barriers only work well when they come in
pairs.  Because we don't actually have memory barriers on the
IRQ path, the memory barrier before the synchronize_irq() doesn't
actually protect us.

In particular, synchronize_irq() may return followed by the
result of netif_rx_schedule being made visible.

This patch (mostly written by Linus) fixes this by using spin
locks instead of memory barries on the synchronize_irq() path.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-23 09:01:31 -07:00
..
autoprobe.c [PATCH] genirq: add handle_bad_irq() 2006-06-29 10:26:24 -07:00
chip.c Compile handle_percpu_irq even for uniprocessor kernels 2007-10-17 08:43:00 -07:00
devres.c rip some includes from linux/interrupt.h 2007-07-28 19:42:22 -07:00
handle.c Fix Linuxdoc comment 2007-05-09 12:30:48 -07:00
internals.h [PATCH] genirq: more verbose debugging on unexpected IRQ vectors 2006-06-29 10:26:25 -07:00
Makefile [PATCH] sort the devres mess out 2007-02-11 11:18:07 -08:00
manage.c Fix synchronize_irq races with IRQ handler 2007-10-23 09:01:31 -07:00
migration.c [PATCH] genirq: Mask irqs when migrating them. 2007-02-26 10:34:08 -08:00
proc.c x86_64: Report the pending irq if available in smp_affinity 2007-07-21 18:37:07 -07:00
resend.c genirq: suppress resend of level interrupts 2007-08-12 11:05:45 -07:00
spurious.c Improve behaviour of spurious IRQ detect 2007-07-16 09:05:46 -07:00