[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCHv6 1/3] xen: use ticket locks for spin locks



On 18/05/15 16:49, Jan Beulich wrote:
>>>> On 18.05.15 at 17:33, <david.vrabel@xxxxxxxxxx> wrote:
>> On 18/05/15 11:16, Jan Beulich wrote:
>>>>>> On 14.05.15 at 13:21, <david.vrabel@xxxxxxxxxx> wrote:
>>>>  void _spin_lock(spinlock_t *lock)
>>>>  {
>>>> +    spinlock_tickets_t tickets = { .tail = 1, };
>>>
>>> This breaks the build on gcc 4.3.x (due to tail being a member of an
>>> unnamed structure member of a union).
>>
>> I don't have a gcc that old to hand but isn't the error here that .tail
>> is part of the structure that isn't the first member of a union?
> 
> No, the error is "unknown field 'tail' specified in initializer", and ...
> 
>> Does this fix your gcc 4.3 build?
> 
> ... hence this doesn't help. Iirc you just can't have initializers for
> unnamed fields or their descendants.

How about this?

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index c8dc8ba..29149d1 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -132,7 +132,7 @@ static always_inline u16
observe_head(spinlock_tickets_t *t)

 void _spin_lock(spinlock_t *lock)
 {
-    spinlock_tickets_t tickets = { .tail = 1, };
+    spinlock_tickets_t tickets = SPINLOCK_TICKET_INC;
     LOCK_PROFILE_VAR;

     check_lock(&lock->debug);
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 311685a..9286543 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -132,6 +132,8 @@ typedef union {
     };
 } spinlock_tickets_t;

+#define SPINLOCK_TICKET_INC { .head_tail = 0x10000, }
+
 typedef struct spinlock {
     spinlock_tickets_t tickets;
     u16 recurse_cpu:12;


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.