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

Re: [PATCH 7/9] x86: Merge xc_cpu_policy's cpuid and msr objects


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 30 Mar 2023 12:56:24 +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=fKBRSv4JaaZqbnws3tYTBKZ84gwOmdgiT4UddP5fZBs=; b=kEyjsVEg21jma2NQXzEsVqzfui1j1UVFFuR1G1AchSfpRxeBzJc86y5rUqTk8We1Q/FezpVCOLUunQSEuyA7NQ8ufpkC+HQYxOCOz4cuo0Sqc8J2CODTajCTG094Mm+cZa3LqaO0hNsocMjx7E9RbRzVxAmplYMZP48M6+5QiZd64G3yXSpSGi6XLtbI/UncYt+pONWoOS2EjmMSKhW4p7hFZyOrbFZIMZ/mfnLnk9gwdwS99rsOS2YuEFJ29cECQL2HNmq0YGuE2eQKooi6fm4Ip8cNLGIqujgmiZdIri3yBCWyGCz9uAgorEWLzVNToyF9S3fP2jJ04klLlwhKgw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eVas2PvWtvJw2dkYkl4qKlVRHzMkVhW4yJPXfXvoib4J2+s6+j6jZHqh/NE+/TJd3BK/mZw8KRx7NJo+f0DNQJCzcme3uix4umTDbUgQq99iE1n4qwFai5GKnIshu8ect2Cnr9ZThCQXFlbje8v/mB8FIMhKQCn9rVIwX6BuoaOKYlT+/qNLWuoS34tYe1bUhwZga1SY43cfn0n5Z1uEpHzRS+eIV7zwPSesSP5PKRFS6LkYhWgsfqrwQiAWonctDmwTAp3QcqW/uOQxM1H0+9eUsfgWl0yNvlmO9ou4rmiKoZsA7pki5iLVSOh92dvCjLR5Adx/GPqnZTOsiavRYA==
  • 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: Thu, 30 Mar 2023 11:56:54 +0000
  • Ironport-data: A9a23:AG4MiavnGF4NrCiLDQ8s8Bzn8efnVHtfMUV32f8akzHdYApBsoF/q tZmKW6FO6zeZzDxeoxxbY+z/UIPuZ7VzdU3GgtpriAwEywa+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVKiffHg3HVQ+IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4bKj6Fv0gnRkPaoQ5ASFzyFMZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMwCzcdRxTeo/KK5aOJWOMr3u4Pa/uoFdZK0p1g5Wmx4fcOZ7nmGvyPz/kImTA6i4ZJAOrUY NcfZXx3dhPcbhZTO1ARTpUjgOOvgXq5eDpdwL6XjfNvvy6Pk0osgP60bou9lt+iHK25mm6xo G7c8nu/KRYdLNGFkhKO8262h/+JliT+MG4XPOTgraA73ALCmQT/DjVVeWfirvacgHfmVtRUC 1MGwhEit/U9oRnDot7VGkfQTGS/lhwWVsdUEuY6wBqQ0aeS6AGcbkAbShZRZdpgs9U5LRQ62 1nMk973CDhHtLyOVWnb5rqStSm1OyUeMSkFfyBscOcey9zqoYV2hBSfSN9mSfexloesR2C2x C2Wpi8jgblVldQMy6iw4VHAhXSru4TNSQk2oA7QWwpJ8z9EWWJsXKTwgXCz0BqKBNzxooWp1 JTcp/Wj0Q==
  • Ironport-hdrordr: A9a23:MOPx/aj2GdKcT+dJxBFr81DUA3BQXvwji2hC6mlwRA09TyXPrb HVoB0+726MtN93YgBHpTngAtjmfZq4z/RICOYqTNSftWXd2FdAT7sSibcKoQeQeREWrdQtrZ uIGpIWYLbN5DNB/KPHCWeDcuoI8Z2u7L2vnuvGymcFd3AQV0ii1WtE48Sgf3GeiDMoOXPxLv Sh2vY=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30/03/2023 11:04 am, Jan Beulich wrote:
> On 29.03.2023 22:51, Andrew Cooper wrote:
>>  /* Sanity test various invariants we expect in the default/max policies. */
>>  static void test_guest_policies(const struct xc_cpu_policy *max,
>>                                  const struct xc_cpu_policy *def)
>>  {
>> -    const struct cpuid_policy *cm = &max->cpuid;
>> -    const struct cpuid_policy *cd = &def->cpuid;
>> -    const struct msr_policy *mm = &max->msr;
>> -    const struct msr_policy *md = &def->msr;
>> +    const struct cpu_policy *m = &max->policy;
>> +    const struct cpu_policy *d = &def->policy;
> Looks like you could reduce code churn by keeping "cm" and "cd" as the
> names, which would also be consistent with you continuing to use "cp"
> in hypervisor code.

It's a unit test - I'm not worried about churn; I'm more concerned about
the end readability.

I did consider swapping {d,m} with {max,def} so the logic below reads:

    if ( ((max->feat.raw[0].d | def->feat.raw[0].d) &

but it occurs to me that because the policies are now merged, I can get
rid of all of the xc_cpu_policy passing and use cpu_policy instead. 
(For inspection purposes, we don't care about the serialisation buffers
on the tail of xc_cpu_policy).

It will be a slightly larger change, but the end result will be better IMO.

~Andrew



 


Rackspace

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