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 06/20] x86/ticketlock: make __ticket_spin_trylock

To: Américo Wang <xiyou.wangcong@xxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 06/20] x86/ticketlock: make __ticket_spin_trylock common
From: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Date: Sat, 13 Nov 2010 11:48:41 +0100
Cc: Nick Piggin <npiggin@xxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Srivatsa, Linux, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>, Virtualization <virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx>, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, Vaddagiri <vatsa@xxxxxxxxxxxxxxxxxx>, Avi Kivity <avi@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>
Delivery-date: Sat, 13 Nov 2010 02:49:39 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=lAmyl4jR0rCo5t8JHNI3uhPvIXwdrqYijIfr2ScbfZQ=; b=CZOelV6X51AQ5h6rjqUG+p3JtEWX36DKu+WVM/JnKN7R7QD5zDWpMxcdk0ETAhZx/x 9tYVIcbOBDI9UFBT+ndyKwpNaalm0GxwNzUqp8BxwxsKkyIqZyDNxdUzHlgIClipclsa SCDa3+qR3PTItS0rXw9mJTecFZQvykHP8L26c=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=Q7iuH7/496AnZrKFjxCxl2knYIeuC/nm1XCOR3J/Ary7MW0SuZUJcjNMnPfcEUSUkV N2hpoCzfOGcYbrisbe0ffjRkV8MKqT+0bzuSvkV0XAnjPTDqC3Vltcv+MiIxFjMtuyxx wl7tD9qGhPTT+rEKEj0h7fZcsBR1Iq9HxPWp8=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20101113101732.GH3837@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> <4cea7b0804de5a2c1249034fc5c4840ade043ff4.1288794124.git.jeremy.fitzhardinge@xxxxxxxxxx> <20101113101732.GH3837@hack>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Le samedi 13 novembre 2010 à 18:17 +0800, Américo Wang a écrit :
> 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 = ACCESS_ONCE(lock->tickets);
> >+    if (tmp.tickets.head != tmp.tickets.tail)
> >+            return 0;
> >+
> >+    new.slock = tmp.slock + (1 << TICKET_SHIFT);
> >+
> >+    ret = cmpxchg(&lock->ticketpair, tmp.slock, new.slock) == tmp.slock;
> >+    barrier();              /* just make nothing creeps before lock is 
> >claimed */
> 
> This one should be smp_wmb(), right? No CONFIG_X86_OOSTORE protected.

cmpxchg() is a full memory barrier, no need for smp_wmb() or barrier()




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

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