From: "H. Peter Anvin" Subject: Re: [PATCH RFC 03/12] x86/ticketlock: Use C for __ticket_spin_unlock Date: Fri, 06 Aug 2010 10:47:23 -0700 Message-ID: <4C5C4AAB.3000606@zytor.com> References: <20100720153845.GA9122@phenom.dumpdata.com> <4C45CC02.7030603@goop.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4C45CC02.7030603@goop.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jeremy Fitzhardinge Cc: Nick Piggin , Xen-devel , Konrad Rzeszutek Wilk , Peter Zijlstra , Linux Kernel Mailing List , Jan Beulich , Avi Kivity List-Id: xen-devel@lists.xenproject.org On 07/20/2010 09:17 AM, Jeremy Fitzhardinge wrote: > > "volatile" would be a compiler barrier, but it has no direct effect on, > or relevence to, the CPU. It just cares about the LOCK_PREFIX. The > "memory" clobber is probably unnecessary as well, since the constraints > already tell the compiler the most important information. We can add > barriers separately as needed. > You absolutely need volatile, since otherwise you're permitting the compiler to split, re-execute or even drop the code. Anything else might work, by accident, but it's not clean. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.