All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 3/6] x86/cpu-policy: Infrastructure for MSR_ARCH_CAPS
Date: Tue, 16 May 2023 14:02:06 +0200	[thread overview]
Message-ID: <347219e4-6c3a-a0ad-b010-4dbd7282c7ad@suse.com> (raw)
In-Reply-To: <20230515144259.1009245-4-andrew.cooper3@citrix.com>

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@citrix.com>

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


  reply	other threads:[~2023-05-16 12:02 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15 14:42 [PATCH 0/6] x86: Introduce MSR_ARCH_CAPS into featuresets Andrew Cooper
2023-05-15 14:42 ` [PATCH 1/6] x86/boot: Rework dom0 feature configuration Andrew Cooper
2023-05-16  7:58   ` Jan Beulich
2023-05-16  9:45     ` Andrew Cooper
2023-05-16 11:43       ` Jan Beulich
2023-05-15 14:42 ` [PATCH 2/6] x86/boot: Adjust MSR_ARCH_CAPS handling for the Host policy Andrew Cooper
2023-05-16 11:47   ` Jan Beulich
2023-05-15 14:42 ` [PATCH 3/6] x86/cpu-policy: Infrastructure for MSR_ARCH_CAPS Andrew Cooper
2023-05-16 12:02   ` Jan Beulich [this message]
2023-05-19 15:36     ` Andrew Cooper
2023-05-22  7:18       ` Jan Beulich
2023-05-15 14:42 ` [PATCH 4/6] x86/cpu-policy: MSR_ARCH_CAPS feature names Andrew Cooper
2023-05-16 12:27   ` Jan Beulich
2023-05-16 12:56     ` Andrew Cooper
2023-05-16 13:11       ` Jan Beulich
2023-05-15 14:42 ` [PATCH 5/6] x86/boot: Record MSR_ARCH_CAPS for the Raw and Host CPU policy Andrew Cooper
2023-05-16 12:53   ` Jan Beulich
2023-05-16 12:59     ` Andrew Cooper
2023-05-15 14:42 ` [PATCH 6/6] x86/boot: Expose MSR_ARCH_CAPS data in guest max policies Andrew Cooper
2023-05-16 13:06   ` Jan Beulich
2023-05-16 13:51     ` Andrew Cooper
2023-05-16 14:06       ` Jan Beulich
2023-05-16 14:16         ` Andrew Cooper
2023-05-16 14:53           ` Jan Beulich
2023-05-16 19:31             ` Andrew Cooper
2023-05-17  9:20               ` Jan Beulich
2023-05-19 15:52                 ` Andrew Cooper
2023-05-22  7:31                   ` Jan Beulich
2023-05-22 14:02                     ` Andrew Cooper
2023-05-16 14:58   ` Jan Beulich
2023-05-19 15:52     ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=347219e4-6c3a-a0ad-b010-4dbd7282c7ad@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.