From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933851Ab0KQI70 (ORCPT ); Wed, 17 Nov 2010 03:59:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60841 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756319Ab0KQI7Z (ORCPT ); Wed, 17 Nov 2010 03:59:25 -0500 Message-ID: <4CE3992E.2070406@redhat.com> Date: Wed, 17 Nov 2010 10:58:22 +0200 From: Avi Kivity User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.6 MIME-Version: 1.0 To: Jeremy Fitzhardinge CC: Jan Beulich , Jeremy Fitzhardinge , Eric Dumazet , xiyou.wangcong@gmail.com, Peter Zijlstra , Nick Piggin , Srivatsa Vaddagiri , Linux Virtualization , Xen-devel , Mathieu Desnoyers , Linux Kernel Mailing List , "H. Peter Anvin" Subject: Re: [PATCH 13/14] x86/ticketlock: add slowpath logic References: <97ed99ae9160bdb6477284b333bd6708fb7a19cb.1289940821.git.jeremy.fitzhardinge@citrix.com> <4CE3A1060200007800022B04@vpn.id2.novell.com> <4CE397C8.9040901@goop.org> In-Reply-To: <4CE397C8.9040901@goop.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/17/2010 10:52 AM, Jeremy Fitzhardinge wrote: > On 11/17/2010 12:31 AM, Jan Beulich wrote: > >>>> On 16.11.10 at 22:08, Jeremy Fitzhardinge wrote: > >> +static inline void __ticket_enter_slowpath(struct arch_spinlock *lock) > >> +{ > >> + if (sizeof(lock->tickets.tail) == sizeof(u8)) > >> + asm (LOCK_PREFIX "orb %1, %0" > >> + : "+m" (lock->tickets.tail) > >> + : "i" (TICKET_SLOWPATH_FLAG) : "memory"); > >> + else > >> + asm (LOCK_PREFIX "orw %1, %0" > >> + : "+m" (lock->tickets.tail) > >> + : "i" (TICKET_SLOWPATH_FLAG) : "memory"); > >> +} > > Came only now to mind: Here and elsewhere, did you try using > > %z0 to have gcc produce the opcode suffix character, rather > > than having these somewhat ugly if()-s? > > Actually in this case I'm pretty sure there's already a "set bit" > function which will do the job. set_bit(), I guess, though it takes a > bit number rather than a mask... > set_bit() operates on a long, while the intel manuals recommend against operating on operands of different size, especially with locked operations. I think newer processors have more relaxed requirements, though. -- error compiling committee.c: too many arguments to function