skge napi->poll() locking bug
Subsystems (2)
PATCH 3/3 skge napi->poll() locking bug
From: Marin Mitov <[email protected]>
According to: Documentation/networking/netdevices.txt:
<cite>napi->poll:
..........
Context: softirq
will be called with interrupts disabled by netconsole.
</cite>
napi->poll() could be called either with interrupts enabled (in softirq context) or disabled (by netconsole), so the irq flag should be preserved.
Inspired by Ingo's resent forcedeth patch :-)
---
drivers/net/skge.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/skge.c renamed from drivers/net/skge.c~skge-napi-poll-locking-bug +4 -2
@@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_structskge_write8 (hw,Q_ADDR (rxqaddr[skge->port],Q_CSR ),CSR_START );if (work_done < to_do) { -spin_lock_irq (&hw->hw_lock); +unsigned long flags; + +spin_lock_irqsave (&hw->hw_lock, flags);__netif_rx_complete (dev, napi); hw->intr_mask |= napimask[skge->port];skge_write32 (hw,B0_IMSK , hw->intr_mask);skge_read32 (hw,B0_IMSK ); -spin_unlock_irq (&hw->hw_lock); +spin_unlock_irqrestore (&hw->hw_lock, flags); }return work_done;
_
Quoted 11 lines · you
From: Marin Mitov <[email protected]>
According to:
Documentation/networking/netdevices.txt:<cite>
napi->poll:
..........
Context: softirq
will be called with interrupts disabled by netconsole.
</cite>
Quoted 6 lines
napi->poll()could be called either with interrupts enabled (in softirq context) or disabled (by netconsole), so the irq flag should be preserved.Inspired by Ingo's resent forcedeth patch :-)
As far as skge driver has not changed since 2.6.24, the patch could be applied to the stable 2.6.24.5 release too.
Marin Mitov
Quoted 31 lines
Signed-off-by Marin Mitov <[email protected]>Acked-by David S. Miller <[email protected]>Cc Jeff Garzik <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/net/skge.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)diff -puN
drivers/net/skge.c~skge-napi-poll-locking-bugdrivers/net/skge.cdrivers/net/skge.c renamed from drivers/net/skge.c~skge-napi-poll-locking-bug +4
-2@@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_structskge_write8 (hw,Q_ADDR (rxqaddr[skge->port],Q_CSR ),CSR_START );if (work_done < to_do) { -spin_lock_irq (&hw->hw_lock); +unsigned long flags; + +spin_lock_irqsave (&hw->hw_lock, flags);__netif_rx_complete (dev, napi); hw->intr_mask |= napimask[skge->port];skge_write32 (hw,B0_IMSK , hw->intr_mask);skge_read32 (hw,B0_IMSK ); -spin_unlock_irq (&hw->hw_lock); +spin_unlock_irqrestore (&hw->hw_lock, flags); }return work_done;_
Quoted 33 lines · [email protected] wrote:
From: Marin Mitov <[email protected]>
According to:
Documentation/networking/netdevices.txt:<cite>
napi->poll:
..........
Context: softirq
will be called with interrupts disabled by netconsole.
</cite>
napi->poll()could be called either with interrupts enabled (in softirq context) or disabled (by netconsole), so the irq flag should be preserved.Inspired by Ingo's resent forcedeth patch :-)
Signed-off-by Marin Mitov <[email protected]>Acked-by David S. Miller <[email protected]>Cc Jeff Garzik <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/net/skge.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)diff -puN
drivers/net/skge.c~skge-napi-poll-locking-bugdrivers/net/skge.cdrivers/net/skge.c renamed from drivers/net/skge.c~skge-napi-poll-locking-bug +0
-0@@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_structskge_write8 (hw,Q_ADDR (rxqaddr[skge->port],Q_CSR ),CSR_START );if (work_done < to_do) {
drivers/net/skge.c static int skge_poll(struct napi_struct · line 3209
Quoted 10 lines
drivers/net/skge.c renamed from drivers/net/skge.c~skge-napi-poll-locking-bug +4
-2-spin_lock_irq (&hw->hw_lock); +unsigned long flags; + +spin_lock_irqsave (&hw->hw_lock, flags);__netif_rx_complete (dev, napi); hw->intr_mask |= napimask[skge->port];skge_write32 (hw,B0_IMSK , hw->intr_mask);skge_read32 (hw,B0_IMSK ); -spin_unlock_irq (&hw->hw_lock); +spin_unlock_irqrestore (&hw->hw_lock, flags);
davem already has this
Quoted 1 line · On Thu, 27 Mar 2008 08:23:13 -0400 Jeff Garzik <[email protected]> wrote:
davem already has this
In which I discover that net-2.6.26 doesn't include net-2.6?
hrm.
David Miller
maintainerFrom: Andrew Morton <[email protected]>
Date: Thu, 27 Mar 2008 10:11:42 -0700
Quoted 5 lines · On Thu, 27 Mar 2008 08:23:13 -0400 Jeff Garzik <[email protected]> wrote:
Quoted 2 lines
davem already has this
In which I discover that net-2.6.26 doesn't include net-2.6?
They get merged into eachother, as needed.