From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Jeff Garzik <jgarzik@pobox.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] napi_synchronize: waiting for NAPI
Date: Thu, 18 Oct 2007 11:33:01 +1000 [thread overview]
Message-ID: <1192671181.12879.13.camel@pasglop> (raw)
In-Reply-To: <20071017182628.6590fcdd@freepuppy.rosehill>
On Wed, 2007-10-17 at 18:26 -0700, Stephen Hemminger wrote:
>
> Could you give a concrete example as to why it needs a smp barrier?
> The test_bit is going to get a consistent result. Are you worried about
> operations ordering before the test_bit()? In that case, one of those
> smp_mb__before_xxx functions is probably what is needed.
test_bit is just a read, without any ordering constraint. It can thus be
totally mixed with anything before.
we want to synchronize. Basically, make sure that whatever we did before
the call is visible to whatever we are synchronizing with (NAPI poll in
our case). That is, in our case, that a previous/concurrent NAPI poll
(that hasn't seen the effect of what we did before) is complete or any
new one will have seen that effect.
thus we need a barrier. At least a read barrier semantic to avoid the
test_bit to dance around and be speculated but I think a full barrier
also making sure that any previous store is visible before we preform
the read is also necessary in pretty much any usage scenario of this
function. I believe this is also a bug in synchronize_irq and possibly
even in napi_disable(). I sent a patch for synchronize_irq() a minute
ago.
Besides, it's not like this was a hot path :-)
Cheers,
Ben.
next prev parent reply other threads:[~2007-10-18 1:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071017202640.171902388@linux-foundation.org>
2007-10-17 20:26 ` [PATCH 1/2] napi_synchronize: waiting for NAPI Stephen Hemminger
2007-10-18 0:21 ` Jeff Garzik
2007-10-18 0:28 ` Benjamin Herrenschmidt
2007-10-18 1:26 ` Stephen Hemminger
2007-10-18 1:33 ` Benjamin Herrenschmidt [this message]
2007-10-17 20:26 ` [PATCH 2/2] sky2: shutdown cleanup Stephen Hemminger
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=1192671181.12879.13.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.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 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).