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

Re: Xen reliance on non-standard GCC features


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 9 Jun 2023 14:25:24 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WmhE+I2M7oc/0YLB1PK3/zPbN1oV0hZIX4fdmICidM0=; b=dPgYawDGcIEg+l0nlBybAjdUZs9gflZVw2Klyc4qM7Du+hdhu+y4M10zICwNAZmVca1sSZWLKhz50HYzg4RcUE0GcUcrr0LklNSmVIs4WeNCCDPHZGRfL4iYfWuqgN+tu/jjQLvMZ2kjoj68u/r2xSLLGKMq1iIkiaZ8F+2Y8FgEq6IwA+kSjmLwuvnyIfi0EFfA3FhVMIVYfG7rqNgsnsqNCi/VsFO2gWQIIWkZTBuyEMWgmNu2y2yy5JqBe3bwRTs96mbzuRsCO/Rm8GJ0RHYxCOW2lL7dgyeTLGU047IhsdBFeFWOOq9jOv+nfeTE8+QrEwPx1vqKQyDcp5xSrA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l1fSTpnU2PFBniKgY5QGGV/ms2l7PtbV0taclPjfSUFMQ9WU60U3QCP/plMrQzDUYI1apqFvGWVg45wiF/ougYKppZ27G8/rU1JTaF4k1dIJ0l8xhJzXTBt/WywNW+bv9AD9/v8RQI8OfEp93z5IzkwXwYkkfZcn+6IVSNFNJHKBpDHSL3YT5Wxp4A+uwRevU0YDDAABy1prUhE2rXlHDfvlw5I1+gFE/hXH6CTeBZqy7JHxjUqQhTsNKSrTEQ0bOKaO1KTjGGSfaAvfXpwX6HOZnSGHu+a0/KaXUga6UcxuSvIJpgZBZUG5XWHQN0nDaZBECD9XQBXf1ozI+Vm6bQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Roberto Bagnara <bagnara@xxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "consulting@xxxxxxxxxxx" <consulting@xxxxxxxxxxx>
  • Delivery-date: Fri, 09 Jun 2023 14:25:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZl26d8Aek6tjnZE6ifkCnLNFck6978WEAgABCdQCAAsOqgIAB4G6AgAFZQICAAEoFAIAAElgA
  • Thread-topic: Xen reliance on non-standard GCC features

Hi,

> On 9 Jun 2023, at 15:19, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Jan,
> 
> On 09/06/2023 09:54, Jan Beulich wrote:
>> On 08.06.2023 14:18, Roberto Bagnara wrote:
>>> On 07/06/23 09:39, Jan Beulich wrote:
>>>> On 05.06.2023 15:26, Roberto Bagnara wrote:
>>>>> On 05/06/23 11:28, Jan Beulich wrote:
>>>>>> On 05.06.2023 07:28, Roberto Bagnara wrote:
>>>>> You are right: here are a few examples for U2:
>>>>> 
>>>>> xen/arch/arm/cpuerrata.c:92.12-92.35:
>>>>> empty initializer list (ill-formed for the C99 standard, ISO/IEC 
>>>>> 9899:1999 Section 6.7.8: "An empty initialization list." [STD.emptinit]). 
>>>>> Tool used is `/usr/bin/aarch64-linux-gnu-gcc-12'
>>>>> xen/include/xen/spinlock.h:31.21-31.23: expanded from macro `_LOCK_DEBUG'
>>>>> xen/include/xen/spinlock.h:143.57-143.67: expanded from macro 
>>>>> `SPIN_LOCK_UNLOCKED'
>>>>> xen/include/xen/spinlock.h:144.43-144.60: expanded from macro 
>>>>> `DEFINE_SPINLOCK'
>>>> 
>>>> I'm afraid this is a bad example, as it goes hand-in-hand with using
>>>> another extension. I don't think using a non-empty initialization list
>>>> is going to work with
>>>> 
>>>> union lock_debug { };
>>> 
>>> Yes, this is C99 undefined behavior 58:
>>> "A structure or union is defined as containing no named members (6.7.2.1)."
>>> 
>>> Here is another example:
>>> 
>>> lpae_t pte = {};
>>> 
>>> whereas we have
>>> 
>>> typedef union {
>>>      uint64_t bits;
>>>      lpae_pt_t pt;
>>>      lpae_p2m_t p2m;
>>>      lpae_walk_t walk;
>>> } lpae_t;
>>> 
>>> 
>>>>> xen/arch/arm/cpuerrata.c:678.5-678.6:
>>>>> empty initializer list (ill-formed for the C99 standard, ISO/IEC 
>>>>> 9899:1999 Section 6.7.8: "An empty initialization list." [STD.emptinit]). 
>>>>> Tool used is `/usr/bin/aarch64-linux-gnu-gcc-12'
>>>>> 
>>>>> xen/arch/arm/cpufeature.c:33.5-33.6:
>>>>> empty initializer list (ill-formed for the C99 standard, ISO/IEC 
>>>>> 9899:1999 Section 6.7.8: "An empty initialization list." [STD.emptinit]). 
>>>>> Tool used is `/usr/bin/aarch64-linux-gnu-gcc-12'
>>>> 
>>>> Both of these are a common idiom we use: The "sentinel" of an array
>>>> of compound type initializer.
>>> 
>>> Wouldn't it be possible writing such sentinels in a standard-compliant
>>> way, like {0} or similar, instead of {}?
>> I would be possible, sure, but the question is whether we want that. Iirc
>> in review comments we've been asking to preferably use {}, for being
>> shorter / less clutter without resulting in any ambiguity.
>>>>>>> U6) Empty declarations.
>>>>> 
>>>>> Examples:
>>>>> 
>>>>> xen/arch/arm/arm64/lib/find_next_bit.c:57.29:
>>>>> empty declaration (ill-formed for the C99 standard, ISO/IEC 9899:1999 
>>>>> Section 6.7: "An empty declaration." [STD.emptdecl]). Tool used is 
>>>>> `/usr/bin/aarch64-linux-gnu-gcc-12'
>>>>> 
>>>>> xen/arch/arm/arm64/lib/find_next_bit.c:103.34:
>>>>> empty declaration (ill-formed for the C99 standard, ISO/IEC 9899:1999 
>>>>> Section 6.7: "An empty declaration." [STD.emptdecl]). Tool used is 
>>>>> `/usr/bin/aarch64-linux-gnu-gcc-12'
>>>> 
>>>> Looks like these could be taken care of by finally purging our
>>>> EXPORT_SYMBOL() stub.
>>>> 
>>>>> xen/arch/arm/include/asm/vreg.h:143.26:
>>>>> empty declaration (ill-formed for the C99 standard, ISO/IEC 9899:1999 
>>>>> Section 6.7: "An empty declaration." [STD.emptdecl]). Tool used is 
>>>>> `/usr/bin/aarch64-linux-gnu-gcc-12'
>>>>> 
>>>>> xen/arch/arm/include/asm/vreg.h:144.26:
>>>>> empty declaration (ill-formed for the C99 standard, ISO/IEC 9899:1999 
>>>>> Section 6.7: "An empty declaration." [STD.emptdecl]). Tool used is 
>>>>> `/usr/bin/aarch64-linux-gnu-gcc-12'
>>>> 
>>>> I'm having trouble spotting anything suspicious there.
>>> 
>>> The macro expands to definitions of inline functions
>>> and after the macro invocation there is a ";".
>>> 
>>> The preprocessed code is then:
>>> 
>>> static inline void foo() { ... }
>>> ;
>>> 
>>> where the final ";" is an empty declaration not allowed by
>>> the C99 language standard.
>> Oh, I see.
>>> Removing the ";" after the macro invocation is a possible solution,
>>> but other possibilities exist if this is strongly unwanted.
>> We have other macros to instantiate functions, and there no stray
>> semicolons are used. I think this wants doing the same way here, but it
>> being Arm code the ultimate say is with the Arm maintainers.
> 
> I don't think there is a reason to keep the ";" after. So I would be fine if 
> this is removed.

+1

Cheers
Bertrand




 


Rackspace

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