Skip to contentSkip to conversation

skge napi->poll() locking bug

PATCH Applied Marin Mitov 3 participants 3 messages Mar 23, 2008 – Mar 26, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 skge napi->poll() locking bug

Hi all,

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 :-)

Regards

Marin Mitov

===============================

drivers/net/skge.c +4 -2
@@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_struct 
 	skge_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;
maintainer Acked-by on v1 1/1
#1 lore raw

From: Marin Mitov <[email protected]>
Date: Sun, 23 Mar 2008 10:20:09 +0200

Please send networking things at least CC:'d to netdev as many networking developers do not subscribe to linux-kernel

Quoted 13 lines

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.

Quoted 7 lines

Inspired by Ingo's resent forcedeth patch :-)

Regards

Marin Mitov

Applied
#2 lore raw
In reply to Marin Mitov
Quoted 34 lines · Marin Mitov

Hi all,

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 :-)

Regards

Marin Mitov

===============================

drivers/net/skge.c +3 -1
@@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_struct 
 	skge_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];

drivers/net/skge.c static int skge_poll(struct napi_struct

Quoted 10 lines
drivers/net/skge.c +1 -2
 		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;
 
 
--

applied