From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754332Ab1I1RR5 (ORCPT ); Wed, 28 Sep 2011 13:17:57 -0400 Received: from claw.goop.org ([74.207.240.146]:38458 "EHLO claw.goop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752788Ab1I1RR4 (ORCPT ); Wed, 28 Sep 2011 13:17:56 -0400 Message-ID: <4E834FBA.1080709@goop.org> Date: Wed, 28 Sep 2011 09:47:54 -0700 From: Jeremy Fitzhardinge User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: Linus Torvalds CC: Jan Beulich , Stephan Diestelhorst , Jeremy Fitzhardinge , Ingo Molnar , Andi Kleen , Peter Zijlstra , Nick Piggin , the arch/x86 maintainers , xen-devel@lists.xensource.com, Avi Kivity , Marcelo Tosatti , KVM , Linux Kernel Mailing List , "H. Peter Anvin" Subject: Re: [Xen-devel] [PATCH 00/10] [PATCH RFC V2] Paravirtualized ticketlocks References: <3300108.XQUp9Wrktc@chlor> <4E81FD52.50106@goop.org> <4E835F8C0200007800058461@nat28.tlf.novell.com> In-Reply-To: X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/28/2011 09:10 AM, Linus Torvalds wrote: > On Wed, Sep 28, 2011 at 8:55 AM, Jan Beulich wrote: >>> just use "lock xaddw" there too. >> I'm afraid that's not possible, as that might carry from the low 8 bits >> into the upper 8 ones, which must be avoided. > Oh damn, you're right. So I guess the "right" way to do things is with > cmpxchg, but some nasty mfence setup could do it too. Could do something like: if (ticket->head >= 254) prev = xadd(&ticket->head_tail, 0xff02); else prev = xadd(&ticket->head_tail, 0x0002); to compensate for the overflow. J