From: Nick Piggin <npiggin@suse.de>
To: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Cc: Arjan van de Ven <arjan@infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: LFENCE instruction (was: [rfc][patch 3/3] x86: optimise barriers)
Date: Wed, 17 Oct 2007 14:24:35 +0200 [thread overview]
Message-ID: <20071017122435.GA14401@wotan.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0710170212090.15954@artax.karlin.mff.cuni.cz>
On Wed, Oct 17, 2007 at 02:30:32AM +0200, Mikulas Patocka wrote:
> > > You already must not place any data structures into WC memory --- for
> > > example, spinlocks wouldn't work there.
> >
> > What do you mean "already"?
>
> I mean "in current kernel" (I checked it in 2.6.22)
Ahh, that's not "current kernel", though ;)
4071c718555d955a35e9651f77086096ad87d498
> > If we already have drivers loading data from
> > WC memory, then rmb() needs to order them, whether or not they actually
> > need it. If that were prohibitively costly, then we'd introduce a new
> > barrier which does not order WC memory, right?
> >
> >
> > > wmb() also won't work on WC
> > > memory, because it assumes that writes are ordered.
> >
> > You mean the one defined like this:
> > #define wmb() asm volatile("sfence" ::: "memory")
> > ? If it assumed writes are ordered, then it would just be a barrier().
>
> You read wrong part of the include file. Really, it is
> (2.6.22,include/asm-i386/system.h):
> #ifdef CONFIG_X86_OOSTORE
> #define wmb() alternative("lock; addl $0,0(%%esp)", "sfence",
> X86_FEATURE_XMM)
> #else
> #define wmb() __asm__ __volatile__ ("": : :"memory")
> #endif
>
> CONFIG_X86_OOSTORE is dependent on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6
> --- so on Intel and AMD, it is really just barrier().
>
> So drivers can't assume that wmb() works on write-combining memory.
Drivers should be able to assume that wmb() orders _everything_ (except
some whacky Altix thing, which I really want to fold under wmb at some
point anyway).
So I decided that old x86 semantics isn't right, and now it really is a
lock op / sfence everywhere.
next prev parent reply other threads:[~2007-10-17 12:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-15 20:47 LFENCE instruction (was: [rfc][patch 3/3] x86: optimise barriers) Mikulas Patocka
2007-10-15 21:37 ` Arjan van de Ven
2007-10-15 22:08 ` Mikulas Patocka
2007-10-16 0:11 ` H. Peter Anvin
2007-10-16 10:17 ` Mikulas Patocka
2007-10-16 15:42 ` LFENCE instruction H. Peter Anvin
2007-10-16 21:25 ` Mikulas Patocka
2007-10-16 0:22 ` LFENCE instruction (was: [rfc][patch 3/3] x86: optimise barriers) Nick Piggin
2007-10-16 10:33 ` Mikulas Patocka
2007-10-16 22:29 ` Nick Piggin
2007-10-16 23:05 ` Mikulas Patocka
2007-10-16 23:21 ` Nick Piggin
2007-10-17 0:30 ` Mikulas Patocka
2007-10-17 12:24 ` Nick Piggin [this message]
2007-10-18 17:06 ` Mikulas Patocka
2007-10-17 5:51 ` Herbert Xu
2007-10-17 12:28 ` Nick Piggin
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=20071017122435.GA14401@wotan.suse.de \
--to=npiggin@suse.de \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikulas@artax.karlin.mff.cuni.cz \
/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