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

Re: [PATCH v1 2/2] x86/cpuid: Detect null segment behaviour on Zen2 CPUs


  • To: Jane Malalane <jane.malalane@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 6 Sep 2021 17:17:55 +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; bh=FdCd0JKyDD9QE5Baa1mY81Z0aybW8BdpAIrhBi9YKkA=; b=ik+HONU9/etGr8GuVTVlDtswh3MRn/Za4SCUSOoXAAZ8ra/+nM7jdhpOCp/KL4G0V8LHnEWB2aKtsdgG2U/H2mx17R9YPMsieFFFJl3w6TnLAcw2WHyjOe/7OSed4PnxwIiLybDNHR48wwbUpI4mLKMNsSfX4lwWFHXmaswrTChgVWZ8VV3PcS76uaDw3LLQqg9TE/bUbFi/X+4tJfQji0yj5742RlRpkl448adRS+rotDRFmxM/KJ/NbUKvh2D2S6KDfvXLAh/0acPz6vLJ2JvAwMsw/2Uuw1f4kqo3qANOtXV2SDGKTEfCPxaro+qMDhqjmtDiCrosm+dhT22VcA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NcH7BRB4QfsE4qI5YLnKnB++J17UcwM358d9O/Han3EoY6zLOSjxMpQgSRY/IRDzIkPKNjeSifekkxJ+6lb8fCJoImhvujMnhGjKbYEx5HLv3OtB40OaLut5ulDaUSAbmxB0yfByS7ndg+jQMe/gA2ADq8ejbZ03XpkGcYg8f7XQ7dpNjSW36ntwtGeDXRLmyrPeyFc/+v9LJV1x0oBYSvAXlSCf7mZL3I3m9WzyEOnOILakMZnXCv4CBpl6iriahfjlOJeglsu49KGXAvfPOtzT4DPN1erquhaRO8xF1X24dfbDv5xyae02QPLJ/nMqiFulVnLxwIXuL5hX5RVFAw==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Pu Wen <puwen@xxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 06 Sep 2021 15:18:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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




 


Rackspace

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