public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl•org>
To: shaw@vranix•com
Cc: netdev@vger•kernel.org
Subject: Re: e1000_xmit_frame and e1000_down racing  with next_to_use?
Date: Wed, 6 Sep 2006 11:13:25 -0700	[thread overview]
Message-ID: <20060906111325.7acab51a@localhost.localdomain> (raw)
In-Reply-To: <4348.38.114.160.126.1157565495.squirrel@webmail.vranix.com>

On Wed, 6 Sep 2006 10:58:15 -0700 (PDT)
shaw@vranix•com wrote:

> Hello All,
> 
> I have a question about the use of the tx_ring->next_to_use variable in
> the e1000.  Specifically, I'm wondering about a race between the use of
> next_to_use in e1000_xmit_frame and the clearing of next_to_use in
> e1000_down via e1000_clean_tx_ring.
> 
> Thread 1 (_xmit) ->  first = adapter->tx_ring.next_to_use;
>                      e1000_tx_map();
> Thread 2 (_down) ->  e1000_clean_tx_ring();
>                      tx_ring->next_to_use = 0;
> Thread 1 (_xmit) -> e1000_tx_queue();
> 
> It seems that tx_ring.next_to_use could change between the time the skbuff
> is mapped in e1000_tx_map and the time it is reported to the hardware in
> e1000_tx_queue.  While I don't see any memory leaks or possible oops, it
> does seem possible that that an skbuff could be "lost" in the ring as it
> will not be queued in the subsequent e1000_queue.
> 
> If the race is possible, perhaps this could be the culprit behind the tx
> timeouts we've seen reported in this list?  The watchdog will eventually
> find the "lost" skbuff and mistakenly think that the hardware transmit has
> hung and stop the queue.
> 
> Could one of you plese tell me how this race is avoided, if indeed it is?
> 
> Thanks,
> Shaw
> 

e1000_down calls netif_stop_queue() and that stops transmit requests.
It doesn't handle the case of a transmit in flight during the e1000_down.

Shouldn't clean_tx_ring acquire tx_ring->tx_lock to avoid that?


-- 
Stephen Hemminger <shemminger@osdl•org>

  reply	other threads:[~2006-09-06 18:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06 17:58 e1000_xmit_frame and e1000_down racing with next_to_use? shaw
2006-09-06 18:13 ` Stephen Hemminger [this message]
2006-09-07  0:18   ` Shaw Vrana
2006-09-08 15:51     ` Auke Kok

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=20060906111325.7acab51a@localhost.localdomain \
    --to=shemminger@osdl$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=shaw@vranix$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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