public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: netdev@vger.kernel.org, Andrew Gallatin <gallatin@myri.com>,
	Brice Goglin <brice@myri.com>
Subject: Re: [RFC] myri10ge: small rx_done refactoring
Date: Thu, 24 Mar 2011 08:15:39 -0700	[thread overview]
Message-ID: <20110324081539.47ad0972@nehalam> (raw)
In-Reply-To: <20110324081621.GA5508@redhat.com>

On Thu, 24 Mar 2011 09:16:21 +0100
Stanislaw Gruszka <sgruszka@redhat.com> wrote:

> On Wed, Mar 23, 2011 at 08:33:57AM -0700, Stephen Hemminger wrote:
> > On Wed, 23 Mar 2011 13:52:04 +0100
> > Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> > 
> > > Add lro_enable variable to read NETIF_F_LRO flag only once per napi poll
> > > call. This should fix theoretical race condition with
> > > myri10ge_set_rx_csum() and myri10ge_set_flags() where flag NETIF_F_LRO
> > > can be changed.
> > 
> > You may need a barrier or the race may still be there.
> 
> I don't understand why barrier in that case is need.
> 
> What I tried to avoid is.
> 
> myri10ge_clean_rx_done():
> 
> if (dev->features & NETIF_F_LRO) 
> 	setup lro 
> 					myri10ge_set_flags()
> 
> if (dev->features & NETIF_F_LRO)
> 	flush lro
> 
> Now we read dev->features & NETIF_F_LRO only once to local
> lro_enabled variable. So we can not flush without setup
> or setup without flush. No idea why memory barries is still
> needed.
> 
> > The driver seems to use mb() where wmb() is intended, and never use rmb()?
> 
> Yes, I think we can have some optimalization here.
> 

Without barrier there is no guarantee that compiler read the flags
into a local variable. It is free to do the same thing as the original
code.

-- 

  reply	other threads:[~2011-03-24 15:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 12:52 [RFC] myri10ge: small rx_done refactoring Stanislaw Gruszka
2011-03-23 15:21 ` Andrew Gallatin
2011-03-23 15:33 ` Stephen Hemminger
2011-03-24  8:16   ` Stanislaw Gruszka
2011-03-24 15:15     ` Stephen Hemminger [this message]
2011-03-24 15:59       ` Stanislaw Gruszka
2011-03-24 16:42         ` Ben Hutchings
2011-03-24 17:29         ` David Howells

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=20110324081539.47ad0972@nehalam \
    --to=shemminger@vyatta.com \
    --cc=brice@myri.com \
    --cc=gallatin@myri.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgruszka@redhat.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