From: Andi Kleen <ak@suse.de>
To: "Bryan O'Sullivan" <bos@pathscale.com>
Cc: linux-kernel@vger.kernel.org, discuss@x86-64.org
Subject: Re: Why is wmb() a no-op on x86_64?
Date: Wed, 18 Jan 2006 17:29:36 +0100 [thread overview]
Message-ID: <200601181729.36423.ak@suse.de> (raw)
In-Reply-To: <1137601417.4757.38.camel@serpentine.pathscale.com>
On Wednesday 18 January 2006 17:23, Bryan O'Sullivan wrote:
> Hi, Andi -
>
> I notice that wmb() is a no-op
Actually it is a compiler optimizer barrier, not a no-op.
> on x86_64 kernels unless
> CONFIG_UNORDERED_IO is set.
Because x86 is architecturally defined as having ordered writes (unless you use
write combining or non temporal stores which normal kernel code doesn't). So it's
not needed.
> Is there any particular reason for this?
> It's not similarly conditional on other platforms, and as a consequence,
> in our driver (which requires a write barrier in some situations for
> correctness), I have to add the following piece of ugliness:
>
> #if defined(CONFIG_X86_64) && !defined(CONFIG_UNORDERED_IO)
> #define ipath_wmb() asm volatile("sfence" ::: "memory")
> #else
> #define ipath_wmb() wmb()
> #endif
Hmm, I suppose one could add a wc_wmb() or somesuch, but WC
is currently deeply architecture specific so I'm not sure
how you can even use it portably.
Why do you need the barrier?
-Andi
next prev parent reply other threads:[~2006-01-18 16:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-18 16:23 Why is wmb() a no-op on x86_64? Bryan O'Sullivan
2006-01-18 16:29 ` Andi Kleen [this message]
2006-01-18 16:52 ` Bryan O'Sullivan
2006-01-18 17:06 ` Jes Sorensen
2006-01-18 17:23 ` Bryan O'Sullivan
2006-01-18 17:31 ` [discuss] " Andi Kleen
2006-01-19 10:03 ` Jes Sorensen
2006-01-18 20:07 ` Roland Dreier
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=200601181729.36423.ak@suse.de \
--to=ak@suse.de \
--cc=bos@pathscale.com \
--cc=discuss@x86-64.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox