netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch for 2.6.25? 3/3] skge napi->poll() locking bug
@ 2008-03-27  7:45 akpm
  2008-03-27 10:03 ` Marin Mitov
  2008-03-27 12:23 ` Jeff Garzik
  0 siblings, 2 replies; 5+ messages in thread
From: akpm @ 2008-03-27  7:45 UTC (permalink / raw)
  To: jeff; +Cc: netdev, akpm, mitov, davem

From: Marin Mitov <mitov@issp.bas.bg>

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 <mitov@issp.bas.bg>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/net/skge.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff -puN drivers/net/skge.c~skge-napi-poll-locking-bug drivers/net/skge.c
--- a/drivers/net/skge.c~skge-napi-poll-locking-bug
+++ a/drivers/net/skge.c
@@ -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] 5+ messages in thread

* Re: [patch for 2.6.25? 3/3] skge napi->poll() locking bug
  2008-03-27  7:45 [patch for 2.6.25? 3/3] skge napi->poll() locking bug akpm
@ 2008-03-27 10:03 ` Marin Mitov
  2008-03-27 12:23 ` Jeff Garzik
  1 sibling, 0 replies; 5+ messages in thread
From: Marin Mitov @ 2008-03-27 10:03 UTC (permalink / raw)
  To: akpm, linux-kernel, netdev

On 27.3.2008, you wrote:
> From: Marin Mitov <mitov@issp.bas.bg>
> 
> 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 :-)
> 
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

> Signed-off-by: Marin Mitov <mitov@issp.bas.bg>
> Acked-by: David S. Miller <davem@davemloft.net>
> Cc: Jeff Garzik <jeff@garzik.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/net/skge.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff -puN drivers/net/skge.c~skge-napi-poll-locking-bug drivers/net/skge.c
> --- a/drivers/net/skge.c~skge-napi-poll-locking-bug
> +++ a/drivers/net/skge.c
> @@ -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] 5+ messages in thread

* Re: [patch for 2.6.25? 3/3] skge napi->poll() locking bug
  2008-03-27  7:45 [patch for 2.6.25? 3/3] skge napi->poll() locking bug akpm
  2008-03-27 10:03 ` Marin Mitov
@ 2008-03-27 12:23 ` Jeff Garzik
  2008-03-27 17:11   ` Andrew Morton
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2008-03-27 12:23 UTC (permalink / raw)
  To: akpm; +Cc: netdev, mitov, davem

akpm@linux-foundation.org wrote:
> From: Marin Mitov <mitov@issp.bas.bg>
> 
> 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 <mitov@issp.bas.bg>
> Acked-by: David S. Miller <davem@davemloft.net>
> Cc: Jeff Garzik <jeff@garzik.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/net/skge.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff -puN drivers/net/skge.c~skge-napi-poll-locking-bug drivers/net/skge.c
> --- a/drivers/net/skge.c~skge-napi-poll-locking-bug
> +++ a/drivers/net/skge.c
> @@ -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);

davem already has this



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

* Re: [patch for 2.6.25? 3/3] skge napi->poll() locking bug
  2008-03-27 12:23 ` Jeff Garzik
@ 2008-03-27 17:11   ` Andrew Morton
  2008-03-27 21:57     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2008-03-27 17:11 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, mitov, davem

On Thu, 27 Mar 2008 08:23:13 -0400 Jeff Garzik <jeff@garzik.org> wrote:

> davem already has this

In which I discover that net-2.6.26 doesn't include net-2.6?

hrm.

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

* Re: [patch for 2.6.25? 3/3] skge napi->poll() locking bug
  2008-03-27 17:11   ` Andrew Morton
@ 2008-03-27 21:57     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2008-03-27 21:57 UTC (permalink / raw)
  To: akpm; +Cc: jeff, netdev, mitov

From: Andrew Morton <akpm@linux-foundation.org>
Date: Thu, 27 Mar 2008 10:11:42 -0700

> On Thu, 27 Mar 2008 08:23:13 -0400 Jeff Garzik <jeff@garzik.org> wrote:
> 
> > 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.

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-27  7:45 [patch for 2.6.25? 3/3] skge napi->poll() locking bug akpm
2008-03-27 10:03 ` Marin Mitov
2008-03-27 12:23 ` Jeff Garzik
2008-03-27 17:11   ` Andrew Morton
2008-03-27 21:57     ` David Miller

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