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: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 03/20] x86/ticketlock: Use C for __ticket_spin_unlock
From: Américo Wang <xiyou.wangcong@xxxxxxxxx>
Date: Sat, 13 Nov 2010 18:05:27 +0800
Cc: Nick Piggin <npiggin@xxxxxxx>, 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: Mon, 15 Nov 2010 01:21:40 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=Pmn4dYMVq9j9jwDN/vMsSNMhJ/jvdMo782RLgs9nVEk=; b=fp7GuqdmCay92bBE5p11Ngo/zQmKtsqafKqV7XfFcWxos5GAmcne5cIFVE5YDc4zwg DBzcvHDjwy5NJLMbMDrUehXh1h5s8VWxuzoA2745NIm2gga8yQoKbqJQjpEE795ZQstr ydPpVfM7ifHiZY0Uzwxpx8ZUGKnf95u5DQ/AM=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=Xdlrpn3MIB+cEJZBuc16JFcsPJZuzknmEnsqyXXvahnOOJrVCKMl0hQWeIxjPLHqZi ndt1K6SJxMvQOeIURusBz8DXnm3eTddW7KDyhNbMErePNdc5FA4WhnrM9xDOry2u/gTE ZSSfQn1dSrsDBHafhKrO387ws++MO7LsRa0eo=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20092775a9df07a5a75820ac250194b535279d51.1288794124.git.jeremy.fitzhardinge@xxxxxxxxxx>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.19 (2009-01-05)
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.

>+
>+}
> #else
>-# define UNLOCK_LOCK_PREFIX
>+static __always_inline void __ticket_unlock_release(struct arch_spinlock 
>*lock)
>+{
>+      barrier();
>+      lock->tickets.head++;
>+      barrier();

The second barrier() is not needed.

Thanks.

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

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