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

Re: [PATCH 4/9] x86: Merge struct msr_policy into struct cpu_policy


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 30 Mar 2023 13:15:22 +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=GVacTh1tgBBQFKPNc8Ong3WaUVzSlbPo+5vRH0B1E6M=; b=F7noyuWesR+U6forgICvMMrFKI84tD2iSy+HqnODvP3WGHut5K8tJTAgeKqn/6BwxqrYqQsgXQj5BuK5NVAHuWbpPFfpcSE1aQBy+hW0+717cp08e+gOZvm6Yh7GrgCkOW/9qbqP5IiO3q5lszRY+ax3VrslpFvMjt7h4YsDxVqIdGF+21Ck50qGzmC+fYYheV3r7na37bFXL4y+foP5dUlsFRIDy3SjiDAo6FRlyC/v38hAc5rfGyyEDbnOPIErFHWvGxRzkqrr+pfLP1UHubd7wvnF6d5WmJWf097zeX7Dr1E5Ysd/SQO6xYqPe1qJ0aaf48gd6a4REbO4x5xsYw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L3s+f/aXBNajv/bHTzE7npn8+EQIGx+SGWnLWB14imVPatVhyLP3P3NYqiitxrbogdGemavSnSYLpFd2/pj9v0TeEWEBVOhVbH4duuAKUnkHb5npRnjWiqrmNk8ZY7RH0ePZgEFwwnsiAEnFnMHMqU9COaqDjSAg/GhtgFVSoJgYUYSBcLF0gk0dKeryXGL1jjC2csjKSpkHSkmiV1WSmxVMbzjiMcWqCzg0r7awXQwpE3Pl5RuXeYfj+p+RjG6DeGg2Yq1s1yrzXaA/5TvmZ1NZnxzT7OaUWTYtbgBDwwhoEtuec4NOE9Y5bwtpq2pIKYF+WeeBe13k9UEdt/2lcQ==
  • 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: Thu, 30 Mar 2023 11:15:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30.03.2023 13:11, Andrew Cooper wrote:
> On 30/03/2023 10:30 am, Jan Beulich wrote:
>> On 29.03.2023 22:51, Andrew Cooper wrote:
>>> --- a/xen/include/xen/lib/x86/cpu-policy.h
>>> +++ b/xen/include/xen/lib/x86/cpu-policy.h
>>> @@ -3,7 +3,6 @@
>>>  #define XEN_LIB_X86_POLICIES_H
>>>  
>>>  #include <xen/lib/x86/cpuid-autogen.h>
>>> -#include <xen/lib/x86/msr.h>
>>>  
>>>  #define FEATURESET_1d     0 /* 0x00000001.edx      */
>>>  #define FEATURESET_1c     1 /* 0x00000001.ecx      */
>>> @@ -107,6 +106,9 @@ const char *x86_cpuid_vendor_to_str(unsigned int 
>>> vendor);
>>>       CPUID_GUEST_NR_XSTATE - !!CPUID_GUEST_NR_XSTATE +  \
>>>       CPUID_GUEST_NR_EXTD + 2 /* hv_limit and hv2_limit */ )
>>>  
>>> +/* Maximum number of MSRs written when serialising msr_policy. */
>>> +#define MSR_MAX_SERIALISED_ENTRIES 2
>> The comment better wouldn't refer to msr_policy anymore, I think.
> 
> Ah yes.  (There's so much comment and library cleanup still to do)
> 
>>  I also
>> wonder whether the comment wouldn't better move ...
>>
>>> @@ -324,6 +326,44 @@ struct cpu_policy
>>>          };
>>>      } extd;
>>>  
>>> +    /*
>>> +     * 0x000000ce - MSR_INTEL_PLATFORM_INFO
>> ... e.g. above here, to increase the chance of it being spotted that
>> it needs updating if another MSR is added here.
> 
> I'm not sure about that.  In its current position, it's next to it's
> CPUID partner.
> 
> The unit tests in test-cpu-policy cross-check that we never get -ENOBUFS
> for a MSR_MAX_* sized destination, so I'm not worried about it actually
> getting stale.

Well, I wasn't worried so much about ending up with a bad commit, but
rather that something you could spot on the first pass while writing
new code might cause you a build or test failure later on, resulting
in extra hunting. But this was merely a thought, nothing I would insist
one (the more that your CPUID sibling argument is of course also
relevant).

Jan



 


Rackspace

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