LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH]skge napi->poll() locking bug
@ 2008-03-23  8:20 Marin Mitov
  2008-03-23 10:19 ` David Miller
  2008-03-26  3:20 ` Jeff Garzik
  0 siblings, 2 replies; 3+ messages in thread
From: Marin Mitov @ 2008-03-23  8:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stephen Hemminger, Jeff Garzik

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

Signed-off-by: Marin Mitov <mitov@issp.bas.bg>
===============================
--- a/drivers/net/skge.c	2008-03-23 09:06:13.000000000 +0200
+++ b/drivers/net/skge.c	2008-03-23 09:24:47.000000000 +0200
@@ -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;



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]skge napi->poll() locking bug
  2008-03-23  8:20 [PATCH]skge napi->poll() locking bug Marin Mitov
@ 2008-03-23 10:19 ` David Miller
  2008-03-26  3:20 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2008-03-23 10:19 UTC (permalink / raw)
  To: mitov; +Cc: linux-kernel, shemminger, jgarzik, netdev

From: Marin Mitov <mitov@issp.bas.bg>
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

> 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
> 
> Signed-off-by: Marin Mitov <mitov@issp.bas.bg>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]skge napi->poll() locking bug
  2008-03-23  8:20 [PATCH]skge napi->poll() locking bug Marin Mitov
  2008-03-23 10:19 ` David Miller
@ 2008-03-26  3:20 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2008-03-26  3:20 UTC (permalink / raw)
  To: Marin Mitov; +Cc: linux-kernel, Stephen Hemminger

Marin Mitov wrote:
> 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
> 
> Signed-off-by: Marin Mitov <mitov@issp.bas.bg>
> ===============================
> --- a/drivers/net/skge.c	2008-03-23 09:06:13.000000000 +0200
> +++ b/drivers/net/skge.c	2008-03-23 09:24:47.000000000 +0200
> @@ -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;
> 
> 
> --

applied



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-26  3:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-23  8:20 [PATCH]skge napi->poll() locking bug Marin Mitov
2008-03-23 10:19 ` David Miller
2008-03-26  3:20 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).