netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Andi Kleen <ak@suse.de>, netdev@oss.sgi.com
Subject: Re: RFR: new SiS gige driver
Date: Sat, 9 Aug 2003 17:27:47 +0200	[thread overview]
Message-ID: <20030809152747.GA1618@wotan.suse.de> (raw)
In-Reply-To: <3F350CC8.3090605@pobox.com>

On Sat, Aug 09, 2003 at 11:01:28AM -0400, Jeff Garzik wrote:
> Andi Kleen wrote:
> >* netif_stop_queue in hard_start_xmit is not protected against the 
> >interrupt by the spinlock. That's racy, isn't it?
> 
> Shouldn't be, if done right.  If the interrupt runs a TX completion 
> cycle, it will run the code
> 	if (work_done && netif_queue_stopped(dev))
> 		netif_wake_queue(dev)
> 
> Since ->hard_start_xmit is guaranteed never to be called if the queue is 
> stopped, you also guaranteed that netif_wake_queue and ->hard_start_xmit 
> are mutually exclusive.

The race is

	CPU0                      CPU1

 	hard_start_xmit          
	release lock
                              TX finished interrupt

	my queue is full...       
                              clean some packets
							  netif_wake_queue

	netif_stop_queue


The netif_wake_queue is lost. It's only deadly when clean some packets
clears the full TX ring, otherwise it will likely recover with the 
next TX finished interrupt but give suboptimal performance.

Fix is to do the my queue is full -> netif_stop_queue inside the spinlock.

-Andi

  reply	other threads:[~2003-08-09 15:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-08 17:39 RFR: new SiS gige driver Jeff Garzik
2003-08-08 19:01 ` Stephen Hemminger
2003-08-09  6:39 ` David S. Miller
2003-08-09 14:15 ` Andi Kleen
2003-08-09 15:01   ` Jeff Garzik
2003-08-09 15:27     ` Andi Kleen [this message]
2003-08-11  1:07       ` Jeff Garzik
2003-08-09 18:10     ` Ben Greear
2003-08-13 18:52       ` Jeff Garzik

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=20030809152747.GA1618@wotan.suse.de \
    --to=ak@suse.de \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.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).