[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4FAA9A49.8080900@zytor.com>
Date: Wed, 09 May 2012 09:24:41 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
CC: Rob Landley <rob@...dley.net>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
Arnd Bergmann <arnd@...db.de>,
Andrew Morton <akpm@...ux-foundation.org>,
David Howells <dhowells@...hat.com>,
Akinobu Mita <akinobu.mita@...il.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Herbert Xu <herbert@...dor.hengli.com.au>,
Stephen Rothwell <sfr@...b.auug.org.au>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org, Gleb Natapov <gleb@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
Avi Kivity <avi@...hat.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] bitops: add _local bitops
On 05/09/2012 08:47 AM, Michael S. Tsirkin wrote:
>
> By the way, clear_bit on x86 does not seem to contain
> an optimization barrier - is my reading correct?
> Lock prefix does not affect the compiler, right?
Yes, as it clearly states in the comment:
* clear_bit() is atomic and may not be reordered. However, it does
* not contain a memory barrier, so if it is used for locking purposes,
* you should call smp_mb__before_clear_bit() and/or
smp_mb__after_clear_bit()
* in order to ensure changes are visible on other processors.
There is clear_bit_unlock() which has the barrier semantics.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists