linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Tulip interrupt uses non IRQ safe spinlock
@ 2005-04-28 20:42 Mark Broadbent
  2005-05-02 14:16 ` Paulo Marques
  2005-05-28  2:24 ` Jeff Garzik
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Broadbent @ 2005-04-28 20:42 UTC (permalink / raw)
  To: linux-kernel, jgarzik, netdev

The interrupt handling code in the tulip network driver appears to use a non 
IRQ safe spinlock in an interrupt context.  The following patch should correct 
this.

Signed-off-by: Mark Broadbent <markb@wetlettuce.com>

Index: linux-2.6.11/drivers/net/tulip/interrupt.c
===================================================================
--- linux-2.6.11.orig/drivers/net/tulip/interrupt.c	2005-03-07 18:11:23.000000000 +0000
+++ linux-2.6.11/drivers/net/tulip/interrupt.c	2005-04-28 16:16:23.000000000 +0100
@@ -567,8 +567,9 @@
 
 		if (csr5 & (TxNoBuf | TxDied | TxIntr | TimerInt)) {
 			unsigned int dirty_tx;
+			unsigned long flags;
 
-			spin_lock(&tp->lock);
+			spin_lock_irqsave(&tp->lock, flags);
 
 			for (dirty_tx = tp->dirty_tx; tp->cur_tx - dirty_tx > 0;
 				 dirty_tx++) {
@@ -640,7 +641,7 @@
 						   dev->name, csr5, ioread32(ioaddr + CSR6), tp->csr6);
 				tulip_restart_rxtx(tp);
 			}
-			spin_unlock(&tp->lock);
+			spin_unlock_irqrestore(&tp->lock, flags);
 		}
 
 		/* Log errors. */

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

* Re: [PATCH] Tulip interrupt uses non IRQ safe spinlock
  2005-04-28 20:42 [PATCH] Tulip interrupt uses non IRQ safe spinlock Mark Broadbent
@ 2005-05-02 14:16 ` Paulo Marques
  2005-05-28  2:24 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Paulo Marques @ 2005-05-02 14:16 UTC (permalink / raw)
  To: Mark Broadbent; +Cc: linux-kernel, jgarzik, netdev

Mark Broadbent wrote:
> The interrupt handling code in the tulip network driver appears to use a non 
> IRQ safe spinlock in an interrupt context.  The following patch should correct 
> this.

Huh? Can a network interrupt handler be interrupted by the same interrupt?

AFAIK, the spin_lock_irqsave is to disable interruptions so that an
interrupt can not happen in the critical section, so that the interrupt
handler can not make modifications to shared data. Am I wrong?

-- 
Paulo Marques - www.grupopie.com

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke (1729 - 1797)


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

* Re: [PATCH] Tulip interrupt uses non IRQ safe spinlock
  2005-04-28 20:42 [PATCH] Tulip interrupt uses non IRQ safe spinlock Mark Broadbent
  2005-05-02 14:16 ` Paulo Marques
@ 2005-05-28  2:24 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2005-05-28  2:24 UTC (permalink / raw)
  To: Mark Broadbent; +Cc: linux-kernel, netdev

Mark Broadbent wrote:
> The interrupt handling code in the tulip network driver appears to use a non 
> IRQ safe spinlock in an interrupt context.  The following patch should correct 
> this.
> 
> Signed-off-by: Mark Broadbent <markb@wetlettuce.com>
> 
> Index: linux-2.6.11/drivers/net/tulip/interrupt.c
> ===================================================================
> --- linux-2.6.11.orig/drivers/net/tulip/interrupt.c	2005-03-07 18:11:23.000000000 +0000
> +++ linux-2.6.11/drivers/net/tulip/interrupt.c	2005-04-28 16:16:23.000000000 +0100
> @@ -567,8 +567,9 @@
>  
>  		if (csr5 & (TxNoBuf | TxDied | TxIntr | TimerInt)) {
>  			unsigned int dirty_tx;
> +			unsigned long flags;
>  
> -			spin_lock(&tp->lock);
> +			spin_lock_irqsave(&tp->lock, flags);
>  
>  			for (dirty_tx = tp->dirty_tx; tp->cur_tx - dirty_tx > 0;
>  				 dirty_tx++) {
> @@ -640,7 +641,7 @@
>  						   dev->name, csr5, ioread32(ioaddr + CSR6), tp->csr6);
>  				tulip_restart_rxtx(tp);
>  			}
> -			spin_unlock(&tp->lock);
> +			spin_unlock_irqrestore(&tp->lock, flags);

It's already inside the interrupt handler, so this patch is not needed.

	Jeff




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

end of thread, other threads:[~2005-05-28  2:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-28 20:42 [PATCH] Tulip interrupt uses non IRQ safe spinlock Mark Broadbent
2005-05-02 14:16 ` Paulo Marques
2005-05-28  2:24 ` 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).