* [PATCH] convert sbmac tx to spin_lock_irqsave to prevent early IRQ enable
@ 2008-09-17 2:25 Weiwei Wang
2008-09-17 11:40 ` Jeff Garzik
0 siblings, 1 reply; 5+ messages in thread
From: Weiwei Wang @ 2008-09-17 2:25 UTC (permalink / raw)
To: linux-mips, jgarzik, ralf
Netpoll will call the interrupt handler with interrupts
disabled when using kgdboe, so spin_lock_irqsave() should
be used instead of spin_lock_irq() to prevent interrupts
from being incorrectly enabled.
Signed-off-by: Weiwei Wang <weiwei.wang@windriver.com>
---
drivers/net/sb1250-mac.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index fe41e4e..ce10cfa 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -2069,9 +2069,10 @@ static irqreturn_t sbmac_intr(int irq,void *dev_instance)
static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev)
{
struct sbmac_softc *sc = netdev_priv(dev);
+ unsigned long flags;
/* lock eth irq */
- spin_lock_irq (&sc->sbm_lock);
+ spin_lock_irqsave(&sc->sbm_lock, flags);
/*
* Put the buffer on the transmit ring. If we
@@ -2081,14 +2082,14 @@ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev)
if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) {
/* XXX save skb that we could not send */
netif_stop_queue(dev);
- spin_unlock_irq(&sc->sbm_lock);
+ spin_unlock_irqrestore(&sc->sbm_lock, flags);
return 1;
}
dev->trans_start = jiffies;
- spin_unlock_irq (&sc->sbm_lock);
+ spin_unlock_irqrestore(&sc->sbm_lock, flags);
return 0;
}
@@ -2568,14 +2569,15 @@ static void sbmac_mii_poll(struct net_device *dev)
static void sbmac_tx_timeout (struct net_device *dev)
{
struct sbmac_softc *sc = netdev_priv(dev);
+ unsigned long flags;
- spin_lock_irq (&sc->sbm_lock);
+ spin_lock_irqsave(&sc->sbm_lock, flags);
dev->trans_start = jiffies;
dev->stats.tx_errors++;
- spin_unlock_irq (&sc->sbm_lock);
+ spin_unlock_irqrestore(&sc->sbm_lock, flags);
printk (KERN_WARNING "%s: Transmit timed out\n",dev->name);
}
--
1.5.5.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] convert sbmac tx to spin_lock_irqsave to prevent early IRQ enable
2008-09-17 2:25 [PATCH] convert sbmac tx to spin_lock_irqsave to prevent early IRQ enable Weiwei Wang
@ 2008-09-17 11:40 ` Jeff Garzik
2008-09-20 20:18 ` Ralf Baechle
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2008-09-17 11:40 UTC (permalink / raw)
To: Weiwei Wang; +Cc: linux-mips, ralf
On Wed, Sep 17, 2008 at 10:25:37AM +0800, Weiwei Wang wrote:
> Netpoll will call the interrupt handler with interrupts
> disabled when using kgdboe, so spin_lock_irqsave() should
> be used instead of spin_lock_irq() to prevent interrupts
> from being incorrectly enabled.
>
> Signed-off-by: Weiwei Wang <weiwei.wang@windriver.com>
> ---
> drivers/net/sb1250-mac.c | 12 +++++++-----
> 1 files changed, 7 insertions(+), 5 deletions(-)
Please send to jeff@garzik.org or jgarzik@pobox.com.
Jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] convert sbmac tx to spin_lock_irqsave to prevent early IRQ enable
2008-09-17 11:40 ` Jeff Garzik
@ 2008-09-20 20:18 ` Ralf Baechle
2008-09-25 19:33 ` Jeff Garzik
0 siblings, 1 reply; 5+ messages in thread
From: Ralf Baechle @ 2008-09-20 20:18 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Weiwei Wang, linux-mips, netdev
On Wed, Sep 17, 2008 at 07:40:51AM -0400, Jeff Garzik wrote:
> On Wed, Sep 17, 2008 at 10:25:37AM +0800, Weiwei Wang wrote:
> > Netpoll will call the interrupt handler with interrupts
> > disabled when using kgdboe, so spin_lock_irqsave() should
> > be used instead of spin_lock_irq() to prevent interrupts
> > from being incorrectly enabled.
> >
> > Signed-off-by: Weiwei Wang <weiwei.wang@windriver.com>
> > ---
> > drivers/net/sb1250-mac.c | 12 +++++++-----
> > 1 files changed, 7 insertions(+), 5 deletions(-)
>
> Please send to jeff@garzik.org or jgarzik@pobox.com.
Jeff - I haven't looked at kgdboe but if he's right half of drivers/net
will need to be fixed ...
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] convert sbmac tx to spin_lock_irqsave to prevent early IRQ enable
2008-09-20 20:18 ` Ralf Baechle
@ 2008-09-25 19:33 ` Jeff Garzik
2008-09-25 23:49 ` Ralf Baechle
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2008-09-25 19:33 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Jeff Garzik, Weiwei Wang, linux-mips, netdev
Ralf Baechle wrote:
> On Wed, Sep 17, 2008 at 07:40:51AM -0400, Jeff Garzik wrote:
>
>> On Wed, Sep 17, 2008 at 10:25:37AM +0800, Weiwei Wang wrote:
>>> Netpoll will call the interrupt handler with interrupts
>>> disabled when using kgdboe, so spin_lock_irqsave() should
>>> be used instead of spin_lock_irq() to prevent interrupts
>>> from being incorrectly enabled.
>>>
>>> Signed-off-by: Weiwei Wang <weiwei.wang@windriver.com>
>>> ---
>>> drivers/net/sb1250-mac.c | 12 +++++++-----
>>> 1 files changed, 7 insertions(+), 5 deletions(-)
>> Please send to jeff@garzik.org or jgarzik@pobox.com.
>
> Jeff - I haven't looked at kgdboe but if he's right half of drivers/net
> will need to be fixed ...
Oh indeed. I mainly do it on a case-by-case basis where people care. I
overall think its a bogus change that deserves pushback, but that
involves non-networking layers. In the end, case-by-case application
seemed to win.
Jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] convert sbmac tx to spin_lock_irqsave to prevent early IRQ enable
2008-09-25 19:33 ` Jeff Garzik
@ 2008-09-25 23:49 ` Ralf Baechle
0 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2008-09-25 23:49 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Jeff Garzik, Weiwei Wang, linux-mips, netdev
On Thu, Sep 25, 2008 at 03:33:40PM -0400, Jeff Garzik wrote:
>>> On Wed, Sep 17, 2008 at 10:25:37AM +0800, Weiwei Wang wrote:
>>>> Netpoll will call the interrupt handler with interrupts
>>>> disabled when using kgdboe, so spin_lock_irqsave() should
>>>> be used instead of spin_lock_irq() to prevent interrupts
>>>> from being incorrectly enabled.
>>>>
>>>> Signed-off-by: Weiwei Wang <weiwei.wang@windriver.com>
>>>> ---
>>>> drivers/net/sb1250-mac.c | 12 +++++++-----
>>>> 1 files changed, 7 insertions(+), 5 deletions(-)
>>> Please send to jeff@garzik.org or jgarzik@pobox.com.
>>
>> Jeff - I haven't looked at kgdboe but if he's right half of drivers/net
>> will need to be fixed ...
>
> Oh indeed. I mainly do it on a case-by-case basis where people care. I
> overall think its a bogus change that deserves pushback, but that
> involves non-networking layers. In the end, case-by-case application
> seemed to win.
Turns out kgdboe isn't upstream yet - but netconsole apparently hast the
same issue.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-09-25 23:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 2:25 [PATCH] convert sbmac tx to spin_lock_irqsave to prevent early IRQ enable Weiwei Wang
2008-09-17 11:40 ` Jeff Garzik
2008-09-20 20:18 ` Ralf Baechle
2008-09-25 19:33 ` Jeff Garzik
2008-09-25 23:49 ` Ralf Baechle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.