[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1192769910.7367.106.camel@pasglop>
Date: Fri, 19 Oct 2007 14:58:30 +1000
From: Benjamin Herrenschmidt <benh@...nel.crashing.org>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
akpm@...ux-foundation.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linuxppc-dev@...abs.org, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] synchronize_irq needs a barrier
On Fri, 2007-10-19 at 12:48 +0800, Herbert Xu wrote:
> [IRQ]: 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@...dor.apana.org.au>
Good for me.
Acked-by: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cheers,
Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists