From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCHv6 1/3] xen: use ticket locks for spin locks Date: Tue, 19 May 2015 11:27:24 +0100 Message-ID: <555B100C.9050804@citrix.com> References: <1431602502-22327-1-git-send-email-david.vrabel@citrix.com> <1431602502-22327-2-git-send-email-david.vrabel@citrix.com> <5559D821020000780007AFC2@mail.emea.novell.com> <555A0650.8010901@citrix.com> <555A2611020000780007B4B1@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YuekE-0003me-Fb for xen-devel@lists.xenproject.org; Tue, 19 May 2015 10:27:30 +0000 In-Reply-To: <555A2611020000780007B4B1@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Keir Fraser , Ian Campbell , Stefano Stabellini , Andrew Cooper , Jennifer Herbert , Tim Deegan , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On 18/05/15 16:49, Jan Beulich wrote: >>>> On 18.05.15 at 17:33, wrote: >> On 18/05/15 11:16, Jan Beulich wrote: >>>>>> On 14.05.15 at 13:21, 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;