All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Jane Malalane <jane.malalane@citrix.com>
Cc: "Wei Liu" <wl@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Pu Wen" <puwen@hygon.cn>, "Andy Lutomirski" <luto@kernel.org>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v1 2/2] x86/cpuid: Detect null segment behaviour on Zen2 CPUs
Date: Mon, 6 Sep 2021 17:17:55 +0200	[thread overview]
Message-ID: <26b88d5a-ae6f-0065-7c3f-5eeb6dd80078@suse.com> (raw)
In-Reply-To: <c9c3228982cc81c79cab4ced983f80296107124a.1630929059.git.jane.malalane@citrix.com>

On 06.09.2021 14:00, Jane Malalane wrote:
> --- a/xen/arch/x86/cpu/amd.c
> +++ b/xen/arch/x86/cpu/amd.c
> @@ -681,6 +681,19 @@ void amd_init_lfence(struct cpuinfo_x86 *c)
>  			  c->x86_capability);
>  }
>  
> +void detect_zen2_null_seg_behaviour(void)

This can in principle be marked __init.

> +{
> +	uint64_t base;
> +
> +	wrmsrl(MSR_FS_BASE, 1);
> +	asm volatile ( "mov %0, %%fs" :: "rm" (0) );

While I don't strictly mind the "m" part of the constraint to remain
there (in the hope for compilers actually to support this), iirc it's
not useful to have when the value is a constant: Last time I checked,
the compiler would not instantiate an anonymous (stack) variable to
fulfill this constraint (as can be seen when dropping the "r" part of
the constraint).

> @@ -731,6 +744,11 @@ static void init_amd(struct cpuinfo_x86 *c)
>  	else /* Implicily "== 0x10 || >= 0x12" by being 64bit. */
>  		amd_init_lfence(c);
>  
> +	/* Probe for NSCB on Zen2 CPUs when not virtualised */
> +	if (!cpu_has_hypervisor && !cpu_has_nscb && c == &boot_cpu_data &&
> +	    c->x86 == 0x17 && c->x86_model >= 30 && c->x86_model <= 0x5f)

DYM 0x30 here? Or 0x1e? In any event 0x5f should be accompanied by
another hex constant. And it would also help if in the description
you said where these bounds as well as ...

> --- a/xen/arch/x86/cpu/hygon.c
> +++ b/xen/arch/x86/cpu/hygon.c
> @@ -34,6 +34,11 @@ static void init_hygon(struct cpuinfo_x86 *c)
>  
>  	amd_init_lfence(c);
>  
> +	/* Probe for NSCB on Zen2 CPUs when not virtualised */
> +	if (!cpu_has_hypervisor && !cpu_has_nscb && c == &boot_cpu_data &&
> +	    c->x86 == 0x18 && c->x86_model >= 4)

... this one come from.

Jan



  reply	other threads:[~2021-09-06 15:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-06 12:00 [PATCH v1 0/2] x86/cpuid: Use AMD's NullSelectorClearsBase CPUID bit Jane Malalane
2021-09-06 12:00 ` [PATCH v1 1/2] x86/cpuid: Expose NullSelectorClearsBase CPUID bit to guests Jane Malalane
2021-09-06 15:04   ` Jan Beulich
2021-09-06 19:20   ` Andrew Cooper
2021-09-06 12:00 ` [PATCH v1 2/2] x86/cpuid: Detect null segment behaviour on Zen2 CPUs Jane Malalane
2021-09-06 15:17   ` Jan Beulich [this message]
2021-09-06 18:07     ` Andrew Cooper
2021-09-07  6:09       ` Jan Beulich
2021-09-07 13:27         ` Andrew Cooper
2021-09-07 14:21           ` Jan Beulich
2021-09-08  8:19   ` [PATCH v2 " Jane Malalane
2021-09-08 12:08     ` Jan Beulich
2021-09-08 12:28       ` 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=26b88d5a-ae6f-0065-7c3f-5eeb6dd80078@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jane.malalane@citrix.com \
    --cc=luto@kernel.org \
    --cc=puwen@hygon.cn \
    --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.