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

Re: [PATCH 1/6] x86/cpu-policy: Drop build time cross-checks of featureset sizes


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 9 May 2023 16:28:09 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=pljH4mRZhaIosXef+zzUdjXC2LaBSHD20eiATYnOl3Y=; b=KNzSvf9bHZIutt2F8EUPPORaretEU0UhGOs4X7rlw26MOV2crnFo9hHnVLp+/9rlcPxxpi9BlflzTXBKdivv4sGwX0KyWxn7mguGuzNNp6DoffolU6IE+fGwx4jjJOeEB1XmIQK7QuDkrZHgFa2rXcbdGpFVCPrvStZ1gsZUXuNdYCcw0HAsjqbGQGIeGUfA1FDJ8ayg4kK1vSBvTxiz9LcUrpWyx8DXVqmeIGvFTecsAJFBtk0/dizyPEMPmR88PCKpCBfk+n9VGLDS4BvPKQscwiNCUkxgRCuChWUxaYLrVpZwUVqlgtRO+xNnB8QWl1j++oOJNCv+1u8uGdFktA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CQDjRF/Cxw7ML6Ch8Ua5pDbmScLjmLUA7o6EHKRnr8YXDpAH2kLHEIF2mrdoeMEqTKBYolLNTpGYli7lYOmZ5cOqDX0e/Y1JhQWr40V4BIi7IowLwsYxZ3tzMdoloW6XMbWcenaJCzoRtLMCEjj7A3Th0gl13tsGLdMepeClKI0CcmB9h9/oxdqYUR6N2UjwrVnLSOn+PTwyiT0RD2bIyM8zni2EiBElnlZHE4DtBclNbpXuOLaZfM6HBJpZvdgSFztSEkrU9rVT5k1K5BGtYmiEIRpQlLnqyKS+upKl0Z83KekWkxCQqsk97eSvzOu60OrTlKUtWwpgZMS3KA3AhA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 09 May 2023 14:28:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.05.2023 15:04, Andrew Cooper wrote:
> On 08/05/2023 7:47 am, Jan Beulich wrote:
>> On 04.05.2023 21:39, Andrew Cooper wrote:
>>> These BUILD_BUG_ON()s exist to cover the curious absence of a diagnostic for
>>> code which looks like:
>>>
>>>   uint32_t foo[1] = { 1, 2, 3 };
>>>
>>> However, GCC 12 at least does now warn for this:
>>>
>>>   foo.c:1:24: error: excess elements in array initializer [-Werror]
>>>     884 | uint32_t foo[1] = { 1, 2, 3 };
>>>         |                        ^
>>>   foo.c:1:24: note: (near initialization for 'foo')
>> I'm pretty sure all gcc versions we support diagnose such cases. In turn
>> the arrays in question don't have explicit dimensions at their
>> definition sites, and hence they derive their dimensions from their
>> initializers. So the build-time-checks are about the arrays in fact
>> obtaining the right dimensions, i.e. the initializers being suitable.
>>
>> With the core part of the reasoning not being applicable, I'm afraid I
>> can't even say "okay with an adjusted description".
> 
> Now I'm extra confused.
> 
> I put those BUILD_BUG_ON()'s in because I was not getting a diagnostic
> when I was expecting one, and there was a bug in the original featureset
> work caused by this going wrong.
> 
> But godbolt seems to agree that even GCC 4.1 notices.
> 
> Maybe it was some other error (C file not seeing the header properly?)
> which disappeared across the upstream review?

Or maybe, by mistake, too few initializer fields? But what exactly it
was probably doesn't matter. If this patch is to stay (see below), some
different description will be needed anyway (or the change be folded
into the one actually invalidating those BUILD_BUG_ON()s).

> Either way, these aren't appropriate, and need deleting before patch 5,
> because the check is no longer valid when a featureset can be longer
> than the autogen length.

Well, they need deleting if we stick to the approach chosen there right
now. If we switched to my proposed alternative, they better would stay.

Jan



 


Rackspace

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