From: Jeremy Fitzhardinge Subject: Re: [PATCH 06/20] x86/ticketlock: make __ticket_spin_trylock common Date: Mon, 15 Nov 2010 11:39:03 -0800 Message-ID: <4CE18C57.9070805@goop.org> References: <4cea7b0804de5a2c1249034fc5c4840ade043ff4.1288794124.git.jeremy.fitzhardinge@citrix.com> <20101113101732.GH3837@hack> <1289645321.2743.21.camel@edumazet-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <1289645321.2743.21.camel@edumazet-laptop> Sender: linux-kernel-owner@vger.kernel.org To: Eric Dumazet Cc: =?UTF-8?B?QW3DqXJpY28gV2FuZw==?= , Peter Zijlstra , Linux Kernel Mailing List , Nick Piggin , Jan Beulich , Avi Kivity , Xen-devel , "H. Peter Anvin" , Linux Virtualization , Srivatsa Vaddagiri , Jeremy Fitzhardinge List-Id: xen-devel@lists.xenproject.org On 11/13/2010 02:48 AM, Eric Dumazet wrote: > Le samedi 13 novembre 2010 =C3=A0 18:17 +0800, Am=C3=A9rico Wang a =C3= =A9crit : >> On Wed, Nov 03, 2010 at 10:59:47AM -0400, Jeremy Fitzhardinge wrote: >> >>> + union { >>> + struct __raw_tickets tickets; >>> + __ticketpair_t slock; >>> + } tmp, new; >>> + int ret; >>> + >>> + tmp.tickets =3D ACCESS_ONCE(lock->tickets); >>> + if (tmp.tickets.head !=3D tmp.tickets.tail) >>> + return 0; >>> + >>> + new.slock =3D tmp.slock + (1 << TICKET_SHIFT); >>> + >>> + ret =3D cmpxchg(&lock->ticketpair, tmp.slock, new.slock) =3D=3D t= mp.slock; >>> + barrier(); /* just make nothing creeps before lock is claimed */ >> This one should be smp_wmb(), right? No CONFIG_X86_OOSTORE protected= =2E > cmpxchg() is a full memory barrier, no need for smp_wmb() or barrier(= ) Agreed. J