|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] Re: [PATCH 01/20] x86/ticketlock: clean up types and accesso
To: |
Américo Wang <xiyou.wangcong@xxxxxxxxx> |
Subject: |
[Xen-devel] Re: [PATCH 01/20] x86/ticketlock: clean up types and accessors |
From: |
Jeremy Fitzhardinge <jeremy@xxxxxxxx> |
Date: |
Mon, 15 Nov 2010 11:36:54 -0800 |
Cc: |
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 11:37:43 -0800 |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
In-reply-to: |
<20101113095732.GF3837@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> <742be99eb6d64784dbc3e446d22df78b7a55fc0c.1288794124.git.jeremy.fitzhardinge@xxxxxxxxxx> <20101113095732.GF3837@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.fc13 Lightning/1.0b3pre Thunderbird/3.1.6 |
On 11/13/2010 01:57 AM, Américo Wang wrote:
> On Wed, Nov 03, 2010 at 10:59:42AM -0400, Jeremy Fitzhardinge wrote:
> ...
>> static __always_inline void __ticket_spin_lock(arch_spinlock_t *lock)
>> {
>> - int inc = 0x00010000;
>> - int tmp;
>> + unsigned inc = 1 << TICKET_SHIFT;
>> + unsigned tmp;
> Please don't use old implicit-int.
I don't mind much either way, but I don't think I've seen anyone worry
about this before.
>> - return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1;
>> + return ((tmp.tail - tmp.head) & TICKET_MASK) > 1;
>
> There is a type promotion here.
...
>> }
>>
>> #ifndef CONFIG_PARAVIRT_SPINLOCKS
>> diff --git a/arch/x86/include/asm/spinlock_types.h
>> b/arch/x86/include/asm/spinlock_types.h
>> index dcb48b2..4582640 100644
>> --- a/arch/x86/include/asm/spinlock_types.h
>> +++ b/arch/x86/include/asm/spinlock_types.h
>> @@ -5,11 +5,27 @@
>> # error "please don't include this file directly"
>> #endif
>>
>> +#include <linux/types.h>
>> +
>> +#if (CONFIG_NR_CPUS < 256)
>> +typedef u8 __ticket_t;
>> +#else
>> +typedef u16 __ticket_t;
>> +#endif
>> +
>> +#define TICKET_SHIFT (sizeof(__ticket_t) * 8)
>> +#define TICKET_MASK ((1 << TICKET_SHIFT) - 1)
>
> So here you may need to cast the result to __ticket_t.
OK.
J
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] Re: [PATCH 03/20] x86/ticketlock: Use C for __ticket_spin_unlock, (continued)
- [Xen-devel] [PATCH 08/20] x86/ticketlock: collapse a layer of functions, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 01/20] x86/ticketlock: clean up types and accessors, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 11/20] x86/pvticketlock: use callee-save for lock_spinning, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 12/20] x86/pvticketlock: use callee-save for unlock_kick as well, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 17/20] x86/ticketlock: clarify barrier in arch_spin_lock, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 14/20] x86/ticketlock: loosen ordering restraints on unlock, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 16/20] x86/ticketlock: don't inline _spin_unlock when using paravirt spinlocks, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 09/20] xen/pvticketlock: Xen implementation for PV ticket locks, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 05/20] x86/ticketlock: make __ticket_spin_lock common, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 10/20] x86/pvticketlock: keep count of blocked cpus, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 20/20] x86/ticketlock: rename ticketpair to head_tail, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 07/20] x86/spinlocks: replace pv spinlocks with pv ticketlocks, Jeremy Fitzhardinge
|
|
|
|
|