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

Re: [PATCH] x86/cpuid: Calculate FEATURESET_NR_ENTRIES more helpfully


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 15 May 2023 11:02:21 +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=QyxrH1OZgCGkCuGj3opBlUiDQhuFXBUTBu1Jug+qvqA=; b=KhZKyYhcn7WzwqTlwiLCRSY6l6chBpJbQJy+8j0alLMjkl+D8x4rkNWXUv2FTFaHNVFhe0l/KoRi3dfRGXaq99IjYmIR3OuCRhAma996YxWZB6M4DIq7qjkEXTgO6okxv4SiiPOYFsrHthR+EZ/dCaojnuRlju4Bj2AJ9BlvfOtgnVQor+sJ83PKhM4+knfWTGGfQuQjeP8dEMvvzUZj+zYVN+m435Lyz0e4/XIrdsYtlatrArKo3/ANcePhHGwW3HH14yomavUbxEZf0NCRbqdBOw1B8vxSMRCwYh0H3aQhOQUzLjwf5eMD8Mf7Bq5jUzeS7rEhY1aliksDQ7iQZQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ATKe343yC73LJmNEoktf/Sr8vAm1WADcOFYDYL5xDc9cihbYayO0uHm5hZKk0SlxeFF+wAGCDNbPbCfnPbu4FL3m+LaXYPRucNSKbh9l0T8MCwlFh6DJPIxum6qnauo7TyidQHf3Ci+mVsabA96VgalxnCvPk94H3BokRfJqw5DKoPHe58P/kv/RQRTgfiUtGoXewazv9/BmNcsRAdEJn9iCewamYDb5JPECTre2wu2IW3g9/4J4yV/atstye8IkGvkFuEMW6zPn56097HU3Oq5lGwqSIPhpoSNmJ5MOhVI5PkycNZ4vduE+Y0SvZO9i9sZiP26NGf65mILKjkrKMw==
  • 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: Mon, 15 May 2023 10:03:00 +0000
  • Ironport-data: A9a23:lvhSVKsvyq4s9P+WYTsHlnFq0efnVHpfMUV32f8akzHdYApBsoF/q tZmKWGHOPyDZjOmfNAkOoq//EJX6MXRnNMwSAdsrCw1QntE+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVKiffHg3HVQ+IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4bKj6Vv0gnRkPaoQ5AKHyiFMZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMwFylKLTeHrMePw7/nTrRw2dV8a8XhBdZK0p1g5Wmx4fcOZ7nmGv2PwOACmTA6i4ZJAOrUY NcfZXx3dhPcbhZTO1ARTpUjgOOvgXq5eDpdwL6XjfNvvy6Pk0osjf60aIK9lt+iHK25mm6xo G7c8nu/KRYdLNGFkhKO8262h/+JliT+MG4XPOThr6My2AfDnQT/DjUPCQC5osO71nSdePt+J 3Ep4XMFsbgboRnDot7VGkfQTGS/lhwWVsdUEuY6wBqQ0aeS6AGcbkAbShZRZdpgs9U5LRQ62 1nMk973CDhHtLyOVWnb5rqStSm1OyUeMSkFfyBscOcey9zqoYV2iw2VSN9mSfaxloesQWm2x C2Wpi8jgblVldQMy6iw4VHAhXSru4TNSQk2oA7QWwpJ8z9EWWJsXKTwgXCz0BqKBN3GJrVdl BDoQ/Sj0d0=
  • Ironport-hdrordr: A9a23:pujAFKFshwgryuoOpLqFk5HXdLJyesId70hD6qm+c20wTiX4rb HboB1/73SbtN9/YhEdcK+7Sda9qB/nlKKdgrNhT4tKIjOW2ldARbsKheHfKlbbak7DH4BmpM Jdm6MXMqyPMbAT5/yX3OHSeexO/DFJmprEuc7ui05ICSVWQ+VY6QF9YzzrZ3GfhmN9dOsE/F 733Ls1m9JkE05nHvhTfUN1ONTrlpnwjZf7ZhxDLwc/gTP+9Q+A2frBCh2F2RVbeC9OxLpKyx m4ryXJop+7tu29yFv632vehq4m/ufJ+594HcmRjcpQDCvqhh3AXvUZZ5Sy+Aotpf2p6hIRsP SkmWZaA+1Dr0nJe32zo1/W1xL+3C0I43vvoGXo+0fLkIjCXTcnDMgEuo5DaBve7CMbzaxB7J 4=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15/05/2023 8:46 am, Jan Beulich wrote:
> On 12.05.2023 14:45, Andrew Cooper wrote:
>> When adding new featureset words, it is convenient to split the work into
>> several patches.  However, GCC 12 spotted that the way we prefer to split the
>> work results in a real (transient) breakage whereby the policy <-> featureset
>> helpers perform out-of-bounds accesses on the featureset array.
>>
>> Fix this by having gen-cpuid.py calculate FEATURESET_NR_ENTRIES from the
>> comments describing the word blocks, rather than from the XEN_CPUFEATURE()
>> with the greatest value.
>>
>> For simplicty, require that the word blocks appear in order.  This can be
>> revisted if we find a good reason to have blocks out of order.
>>
>> No functional change.
>>
>> Reported-by: Jan Beulich <jbeulich@xxxxxxxx>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> As far as my Python goes:
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Thanks.

> Just one remark further down.
>
>> This supercedes the entire "x86: Fix transient build breakage with featureset
>> additions" series, but doesn't really feel as if it ought to be labelled v2
> Thank you for re-doing this altogether. I think it's more safe this way,
> and it now being less intrusive is imo also beneficial.

Yeah, now I've done both I do prefer this version.

>> --- a/xen/tools/gen-cpuid.py
>> +++ b/xen/tools/gen-cpuid.py
>> @@ -94,6 +118,15 @@ def parse_definitions(state):
>>      if len(state.names) == 0:
>>          raise Fail("No features found")
>>  
>> +    if state.nr_entries == 0:
>> +        raise Fail("No featureset word info found")
>> +
>> +    max_val = max(state.names.keys())
>> +    if (max_val >> 5) + 1 > state.nr_entries:
> Maybe
>
>     if (max_val >> 5) >= state.nr_entries:

Done.

~Andrew



 


Rackspace

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