xen-devel
[Xen-devel] Re: [PATCH 06/20] x86/ticketlock: make __ticket_spin_trylock
To: |
Eric Dumazet <eric.dumazet@xxxxxxxxx> |
Subject: |
[Xen-devel] Re: [PATCH 06/20] x86/ticketlock: make __ticket_spin_trylock common |
From: |
Jeremy Fitzhardinge <jeremy@xxxxxxxx> |
Date: |
Mon, 15 Nov 2010 11:39:03 -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>, Américo Wang <xiyou.wangcong@xxxxxxxxx> |
Delivery-date: |
Mon, 15 Nov 2010 11:44:56 -0800 |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
In-reply-to: |
<1289645321.2743.21.camel@edumazet-laptop> |
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> <1289645321.2743.21.camel@edumazet-laptop> |
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.fc13 Lightning/1.0b3pre Thunderbird/3.1.6 |
On 11/13/2010 02:48 AM, Eric Dumazet wrote:
> 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()
Agreed.
J
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|