[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: Jan Beulich <jbeulich@xxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Tue, 9 May 2023 16:59:37 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=AkvkqYWUH0cLPGfLd0sXi0jaQLqO4CG8XTHHa6qEJQs=; b=Za9ylj33Ueu4HQeMs+yYb196mSjyKABdz46y5LIZUf+JggJS2l9HrogCGxofM9MtTXGv/JUuAvipCg79ZP9Y/RKRSQfxc+Pm8s9mDGXUnOiUho7u7+hFpPjBUtVtZsP5Iuv7FBj6pvUkLIhsTR+FVxxzBSAY3XG/rr1aadVeeN5OpOtTAbjxMHprgth3tOCg8tucwIeQghUiBgilPdxJy5JnJSlQmOV8zXIA2CXZgEfYg2J4jjxc8I7GhgTKSVYHjXI7cB0KWa1zvAiG2Zn2oq29UAgj7ms93PmB3dwHHXmwU5M1XfBYn5rW6w9gZwxfJw6151wludAQ0iRacA1NWQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jWF7UH+hulSXeiYvbeb3gvpF2vAnoyotoxW5mJ1gmka5bw4b/VI5hyOUhR6YGqHzY1bSBFfE+Ua5qzOX/2ti8ffaWAFomPYI1cwurSsHZtpjDaiZ7Nhpv873x2hWsd9Q427rZ2CflD/mthSw4EKENCNneCbJqTnpCGoQBia6AtUmOmiwZ5kFd8EOid7/FvSowYqGn7uqZtm2zrHJOLbVdWmCckLmFz3hffLIjQxLbW+5xzNo0VJvzfCLIFY3OxTRxjHPX4SKk24eG/GX6FG2dyzxxJwAan7KaKHsdd8eA7Rqdugdh2Pu3lg0QuscbH4KtR0NLyLJp6jxPsuL2Zw61Q==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 09 May 2023 16:00:16 +0000
- Ironport-data: A9a23:RLXN/akW4qcIzd2JLEmRPF3o5gysJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xJJXGuBbvjcMzSjLdwkPd7l8RlXsJ7Un4RhGlQ+ri9kRCMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icfHgqH2eIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE4p7aWaVA8w5ARkPqgW5A6GzRH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 eM+DGEzVVO6vcmnxJWAa9cv3/8Ncsa+aevzulk4pd3YJdAPZMmaBo/stZpf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVkVw3iea8WDbWUoXiqcF9t0CUv G/ZuU/+BQkXLoe3wjuZ6HO8wOTImEsXXapLTOLhqaU02wL7Kmo7FloGfny8gOKD0V+iacxzC hMv5AUOlP1nnKCsZpynN/Gim1aGtBMBX9tbE8Uh9RqAjKHT5m6xGWwsXjNHLts8u6ceVTEsk 1OEgd7tLThuq6GOD2KQ8K+OqjG/MjRTKnUNDRLoViMA6tjn5Ys13hTGS486FLbv14OkXzbt3 zqNsS4ywa0JitIG3Lm6+laBhC+wop/OTUg+4QC/sn+Z0z6VrbWNP+SAgWU3J94ZRGpFZjFtZ EQ5pvU=
- Ironport-hdrordr: A9a23:zQmUbaNxK5kDN8BcTuejsMiBIKoaSvp037B87TEKdfVwSL3gqy nIpoV86faUskd3ZJhEo7q90ca7MBDhHPJOgbX5Xo3SODUO2lHYTr2KtrGSuwEIcheWnoVgPM xbAs1D4bPLbGRSvILT/BS/CNo4xcnvytHSuQ4c9RtQpMNRBp2IIz0XNu9TKCNLeDU=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 09/05/2023 3:28 pm, Jan Beulich wrote:
> 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.
Given that all versions of GCC do warn, I don't see any justification
for them to stay.
i.e. this should be committed, even if the commit message says "no idea
what they were taken originally, but they're superfluous in the logic as
it exists today".
~Andrew
|