]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
Fix synchronize_irq races with IRQ handler
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 21 Nov 2007 22:09:39 +0000 (17:09 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 14 Dec 2007 17:50:52 +0000 (09:50 -0800)
commitbedda54e2848df514fd1e045de652700e284d787
treea095e315c7600f3602297b271d258d2e4fa0e264
parent96219ec9d6b461e7587a51280ab5336a78234f86
Fix synchronize_irq races with IRQ handler

patch a98ce5c6feead6bfedefabd46cb3d7f5be148d9a in mainline.

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>
Cc: Chuck Ebbert <cebbert@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/irq/manage.c