WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 03/20] x86/ticketlock: Use C for __ticket_spin_un

To: Américo Wang <xiyou.wangcong@xxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 03/20] x86/ticketlock: Use C for __ticket_spin_unlock
From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Date: Sat, 13 Nov 2010 23:34:06 +0100
Cc: Nick Piggin <npiggin@xxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Srivatsa Vaddagiri <vatsa@xxxxxxxxxxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>, Linux Virtualization <virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx>, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, Avi Kivity <avi@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>
Delivery-date: Sat, 13 Nov 2010 14:35:07 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=7aHWvG7fDPI6pWxmm/tWjSHssOHMezs4Ao+KeL8Aluo=; b=pd4GVc9JVQuejxhKForEbMsjGrkV/eOrXWu2smws21tuF7ukD5dmmIBNN9DEse24zD JUXJDthBdOBEtP1vG1XNdPXMZguPOo/F0FY2qDs2JSXgAr5WeqLoWMU1JeS9GvS3qCaj wg3nPTJCm5zHmJexXoK4nXceX3orSsV12LEJE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=p2SDfsR36ZDUae+Xp+CcObwVZ/EH4R5DlpaJf1x4g5b42CWlUIp5dYY14nXQuTEVdH eBBqNYehOfwj13ZcPvjdKFauRTMasWLTfWlY+wuKT2/WnXZcokkW2YDDBpJpjAjo9wEP vd26zzLHym34FHcnXw7wYBZFmOIhpkzCAtZKo=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20101113100527.GG3837@hack>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <cover.1288794124.git.jeremy.fitzhardinge@xxxxxxxxxx> <20092775a9df07a5a75820ac250194b535279d51.1288794124.git.jeremy.fitzhardinge@xxxxxxxxxx> <20101113100527.GG3837@hack>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.1.6-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.6
On 11/13/2010 11:05 AM, Américo 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_spinlock *lock)
+{
+       if (sizeof(lock->tickets.head) == 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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>