From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Gary Zambrano <zambrano@broadcom.com>,
jgarzik@pobox.com, akpm@linux-foundation.org,
netdev@vger.kernel.org
Subject: Re: [PATCH] b44: netpoll locking fix
Date: Tue, 29 May 2007 15:30:33 -0700 [thread overview]
Message-ID: <20070529153033.0230974f@freepuppy> (raw)
In-Reply-To: <20070529222041.GB31200@electric-eye.fr.zoreil.com>
On Wed, 30 May 2007 00:20:41 +0200
Francois Romieu <romieu@fr.zoreil.com> wrote:
> Stephen Hemminger <shemminger@linux-foundation.org> :
> ⅜...]
> > Better to just get rid of using the lock as a transmit lock and
> > use netif_tx_lock instead.
> > --- a/drivers/net/b44.c 2007-05-29 09:51:43.000000000 -0700
> > +++ b/drivers/net/b44.c 2007-05-29 14:26:03.000000000 -0700
> > @@ -607,6 +607,7 @@ static void b44_tx(struct b44 *bp)
> > {
> > u32 cur, cons;
> >
> > + netif_tx_lock(bp->dev);
> > cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK;
> > cur /= sizeof(struct dma_desc);
> >
>
> (damn, you are quick)
>
> I am not completely convinced.
>
> 1. netpoll_send_skb (calls netif_tx_trylock(dev))
> -> netpoll_poll(np)
> -> poll_napi(np)
> -> np->dev->poll(np->dev, &budget) ( == b44_poll)
> -> b44_tx
> -> netif_tx_lock(bp->dev) *deadlock*
Netpoll needs to be fixed. (or scrapped), as is it will break drivers
trying to use tx_lock in poll routine. I know sky2 would get borked.
Something like this:
--- a/net/core/netpoll.c 2007-05-08 14:19:32.000000000 -0700
+++ b/net/core/netpoll.c 2007-05-29 15:28:22.000000000 -0700
@@ -250,22 +250,23 @@ static void netpoll_send_skb(struct netp
unsigned long flags;
local_irq_save(flags);
- if (netif_tx_trylock(dev)) {
- /* try until next clock tick */
- for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
- tries > 0; --tries) {
+ /* try until next clock tick */
+ for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
+ tries > 0; --tries) {
+ if (netif_tx_trylock(dev)) {
if (!netif_queue_stopped(dev))
status = dev->hard_start_xmit(skb, dev);
+ netif_tx_unlock(dev);
if (status == NETDEV_TX_OK)
break;
- /* tickle device maybe there is some cleanup */
- netpoll_poll(np);
-
- udelay(USEC_PER_POLL);
}
- netif_tx_unlock(dev);
+
+ /* tickle device maybe there is some cleanup */
+ netpoll_poll(np);
+
+ udelay(USEC_PER_POLL);
}
local_irq_restore(flags);
}
next prev parent reply other threads:[~2007-05-29 22:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-29 21:14 [PATCH] b44: netpoll locking fix Francois Romieu
2007-05-29 21:27 ` Stephen Hemminger
2007-05-29 22:20 ` Francois Romieu
2007-05-29 22:30 ` Stephen Hemminger [this message]
2007-05-29 23:13 ` John W. Linville
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070529153033.0230974f@freepuppy \
--to=shemminger@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
--cc=zambrano@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).