From: Paolo Bonzini Subject: Re: [PATCH 03/20] x86/ticketlock: Use C for __ticket_spin_unlock Date: Sat, 13 Nov 2010 23:34:06 +0100 Message-ID: <4CDF125E.3050803@redhat.com> References: <20092775a9df07a5a75820ac250194b535279d51.1288794124.git.jeremy.fitzhardinge@citrix.com> <20101113100527.GG3837@hack> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20101113100527.GG3837@hack> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: =?ISO-8859-1?Q?Am=E9rico_Wang?= Cc: Nick Piggin , Jeremy Fitzhardinge , Xen-devel , Peter Zijlstra , Srivatsa Vaddagiri , Linux Kernel Mailing List , Jan Beulich , Linux Virtualization , Jeremy Fitzhardinge , Avi Kivity , "H. Peter Anvin" List-Id: xen-devel@lists.xenproject.org On 11/13/2010 11:05 AM, Am=E9rico Wang wrote: > On Wed, Nov 03, 2010 at 10:59:44AM -0400, Jeremy Fitzhardinge wrote: >> * On PPro SMP or if we are using OOSTORE, we use a locked operation = to unlock >> * (PPro errata 66, 92) >> */ >> -# define UNLOCK_LOCK_PREFIX LOCK_PREFIX >> +static __always_inline void __ticket_unlock_release(struct arch_spinl= ock *lock) >> +{ >> + if (sizeof(lock->tickets.head) =3D=3D sizeof(u8)) >> + asm (LOCK_PREFIX "incb %0" >> + : "+m" (lock->tickets.head) : : "memory"); >> + else >> + asm (LOCK_PREFIX "incw %0" >> + : "+m" (lock->tickets.head) : : "memory"); > > This 'if/else' really should be done with #ifdef, even though > the compiler may be smart enough to remove it. That's a sure path to bitrot. Paolo