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

Re: [PATCH 3/6] x86/cpu-policy: Infrastructure for MSR_ARCH_CAPS


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 16 May 2023 14:02:06 +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=FI+GX9LyzdYreaRhLZ0JN05S1nJBy9Ec7jzMujIlx60=; b=mLN+iPW0OR0NxXS1tNcKqI5nf9WJhJk58jsdToh4oJI34gusRJoZXKPhQ7TdR9TpKDgn54df5qjHSHU5b7STqF5QJ01jWSc+grnITUc4rTmH0E4J2j/j6UDpTncBj3eCKw01tC5ZeQ6NW8BLbkHKzspw7Bir1n2ffOI/KTecitMaR0wV6ig4lc5NmGt63yFeLf369AdITk6H/ybtAmLwYfVokTULy6X9C3pzSgcDEDZf8msH0hDway0Av2+fr/0/w5zIJcs3HQeKDWOw/IgSY+kdAu8GduuuhE7wRYUC+D6+SrirGlIH3HbWm2UVSbm2cJSrvZervopTqwzPtcYpbw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E8walw5CQquGVOWeyXPsaEr+Xx6HIVQ6ZT2jEmXYxJKmbQ4eGiO2tyMHgnG+DyajBrik/64wTe50rBL0qRtwTyO84UcT38BI6aZTsGe91vduW4nxfd7mm6Ev/mIYw6e9bRu2Lj9yywKizvNd4rThVdf4WdPhHaKL4sGAEmh7NK9/2AWmdrSCP4vkZyPrvCcKkThY5jfzVUb9KD+RFWFQge2uqlzbj+tVwYYDTGGYJF2Q4R0lWt889xSAZnIJtuQkJVeyjndCB5Gw0F5RdnzcXyP6kPm3f4ZTlhYNJiKuDxKpJc5k2WYSUdwdZSY7jye0Enj0haI26aKcMZcRs4GdxA==
  • 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, 16 May 2023 12:02:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.05.2023 16:42, Andrew Cooper wrote:
> Bits through 24 are already defined, meaning that we're not far off needing
> the second word.  Put both in right away.
> 
> The bool bitfield names in the arch_caps union are unused, and somewhat out of
> date.  They'll shortly be automatically generated.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

I'm largely okay, but I'd like to raise a couple of naming / presentation
questions:

> --- a/tools/misc/xen-cpuid.c
> +++ b/tools/misc/xen-cpuid.c
> @@ -226,6 +226,14 @@ static const char *const str_7d2[32] =
>      [ 4] = "bhi-ctrl",      [ 5] = "mcdt-no",
>  };
>  
> +static const char *const str_10Al[32] =
> +{
> +};
> +
> +static const char *const str_10Ah[32] =
> +{
> +};
> +
>  static const struct {
>      const char *name;
>      const char *abbr;
> @@ -248,6 +256,8 @@ static const struct {
>      { "0x00000007:2.edx", "7d2", str_7d2 },
>      { "0x00000007:1.ecx", "7c1", str_7c1 },
>      { "0x00000007:1.edx", "7d1", str_7d1 },
> +    { "0x0000010a.lo",   "10Al", str_10Al },
> +    { "0x0000010a.hi",   "10Ah", str_10Ah },

The MSR-ness can certainly be inferred from the .lo / .hi and l/h
suffixes of the strings, but I wonder whether having it e.g. like

    { "MSR0000010a.lo",   "m10Al", str_10Al },
    { "MSR0000010a.hi",   "m10Ah", str_10Ah },

or

    { "MSR[010a].lo",   "m10Al", str_10Al },
    { "MSR[010a].hi",   "m10Ah", str_10Ah },

or even

    { "ARCH_CAPS.lo",   "m10Al", str_10Al },
    { "ARCH_CAPS.hi",   "m10Ah", str_10Ah },

wouldn't make it more obvious. For the two str_*, see below.

> --- a/xen/include/public/arch-x86/cpufeatureset.h
> +++ b/xen/include/public/arch-x86/cpufeatureset.h
> @@ -307,6 +307,10 @@ XEN_CPUFEATURE(AVX_VNNI_INT8,      15*32+ 4) /*A  
> AVX-VNNI-INT8 Instructions */
>  XEN_CPUFEATURE(AVX_NE_CONVERT,     15*32+ 5) /*A  AVX-NE-CONVERT 
> Instructions */
>  XEN_CPUFEATURE(CET_SSS,            15*32+18) /*   CET Supervisor Shadow 
> Stacks safe to use */
>  
> +/* Intel-defined CPU features, MSR_ARCH_CAPS 0x10a.eax, word 16 */
> +
> +/* Intel-defined CPU features, MSR_ARCH_CAPS 0x10a.edx, word 17 */

Right here I'd be inclined to omit the MSR index; the name ought to
be sufficient.

> --- a/xen/include/xen/lib/x86/cpu-policy.h
> +++ b/xen/include/xen/lib/x86/cpu-policy.h
> @@ -20,6 +20,8 @@
>  #define FEATURESET_7d2   13 /* 0x00000007:2.edx    */
>  #define FEATURESET_7c1   14 /* 0x00000007:1.ecx    */
>  #define FEATURESET_7d1   15 /* 0x00000007:1.edx    */
> +#define FEATURESET_10Al  16 /* 0x0000010a.eax      */
> +#define FEATURESET_10Ah  17 /* 0x0000010a.edx      */

Just like we use an "e" prefix for extended CPUID leaves, perhaps
use an "m" prefix for MSRs (then also affecting e.g. the str_*
above)?

Jan



 


Rackspace

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