All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: "Herbert Xu" <herbert@gondor.apana.org.au>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] tg3: Fix tx race condition
Date: Mon, 07 Aug 2006 20:05:36 -0700	[thread overview]
Message-ID: <1155006336.5328.24.camel@rh4> (raw)
In-Reply-To: <20060808025117.GA13077@gondor.apana.org.au>

On Tue, 2006-08-08 at 12:51 +1000, Herbert Xu wrote:

> > 2. Eliminate the private tx_lock altogether and rely solely on
> > netif_tx_lock.  This eliminates one spinlock in tg3_start_xmit()
> > when the ring is full.
> 
> Why not get rid of the lock altogether? By making sure memory
> barriers are present on the stop/wake paths the locks are not
> needed anymore.

Without the lock, I think you can still wake the queue with an empty
ring in some cases.  Although we handle it properly by returning
NETDEV_TX_BUSY, it is considered a BUG condition in tg3.

> 
> > 4. Make tx_cons and tx_prod volatile to guarantee that
> > tg3_start_xmit() and tg3_tx() will see the latest ring indices.
> 
> Such uses of volatile are bad inside the kernel because they
> don't actually provide hardware memory barriers and their effect
> on the compiler are given by constructs such as mb() anyway.
> 

Just trying to prevent the compiler from optimizing the code.  In cases
where we need hardware barriers we use mb.

> So we should simply add memory barriers where needed.
> 

I can do that.  It will be more mb() scattered in the driver.  Actually,
I can probably hide it in the TX_BUFFS_AVAIL() macro.


  reply	other threads:[~2006-08-08  3:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-08  2:46 [PATCH] tg3: Fix tx race condition Michael Chan
2006-08-08  2:51 ` Herbert Xu
2006-08-08  3:05   ` Michael Chan [this message]
2006-08-08  3:05     ` David Miller
2006-08-08  4:10       ` [PATCH v2] " Michael Chan
2006-08-08  4:21         ` David Miller
2006-08-08  4:23           ` Herbert Xu
2006-08-08  4:46             ` David Miller
2006-08-08  3:04 ` [PATCH] " David Miller

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=1155006336.5328.24.camel@rh4 \
    --to=mchan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    /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 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.