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

RE: [PATCH v10 01/12] xen/vmx: let opt_ept_ad always reflect the current setting


  • To: Juergen Gross <jgross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Mon, 25 May 2020 02:23:26 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.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-SenderADCheck; bh=rqPAxylaS6SBe/APk128XonbFl3wXDRqrfyy3LBRXco=; b=HlakCpWjneAQRHRfbD6TFjGL4WByw9A2EYxBIZBkaO1Mu+l88qI53qE4Nm3ht+ngWsqol0qaYH3D96QO5sPhrQpc8/TwOLSbMaw6skredXbhVU1UR+uw4rmfTqFBvzk4O9HOnNeYy9/ZnYkdBCPDQTUxFGem/8fArf+v3sQ9GswHyldPekDraOjXA6sSQX3TGep/QIwCKxqYiJVkOq4kbB81ihqBAWJLyrACv6V8oESujStsEiOQ6sboZu2ITjNnGZsw5tnC+zTZwpXEL3aKrVVdn6+OMtfs/5bLl6CddNwvWpWhNKZwDMvWR63+CzyrVFu34Gt9dUqrYby4W5BYjg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TrcE6iMwum8rLs8kCGb0YLOmGqqT0jKr1ilaNfl2bp7FxhWhsDyoc/4jwO2k5oTFQeKMitUv2LJ/KvmE7cwZ+ansGlTgkunQAkhCxQKMnVH551wgemQcc3KuWEWgn36Zh4aHnIKZleNW27qpIjJk8uvjCqvTrqz776jsc+Oozgwant+WO9B7tQakwTqJNUCMBbo1FIr8Xl0ZKvqQUQQdmv6yD5ipFY1p0Q3B1sbG+UCpsaSe7CrnvlCjGXbUrbxtFndwC0oZUb7VqwBQ8u1Rwnc4wKVm2WtF7AF1xmvIIxcdYOuc6FcR1pCOBbme0/AGK7ix7wOgukzY7nZzgJ3Oeg==
  • Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=intel.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 25 May 2020 02:23:37 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.2.0.6
  • Ironport-sdr: 50EyUgrY01Bi04spkkuLiQSIBaSCvBivcvalZ07IiGvAPRseYkrc/I4kIUqsW+XUdglCdLmHZv MQh9Vc1gmu+w==
  • Ironport-sdr: unpRITaDVihedDHsd1pyS0il930zIp7e3H+1/vBeNO39cLG0/h1MIY1DfLYgokUfZEkPDiEtgX yysZKGig247A==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWLa4sYjkLeqlY40OG/TZ4iiK9pai4G3aw
  • Thread-topic: [PATCH v10 01/12] xen/vmx: let opt_ept_ad always reflect the current setting

> From: Juergen Gross <jgross@xxxxxxxx>
> Sent: Tuesday, May 19, 2020 3:21 PM
> 
> In case opt_ept_ad has not been set explicitly by the user via command
> line or runtime parameter, it is treated as "no" on Avoton cpus.
> 
> Change that handling by setting opt_ept_ad to 0 for this cpu type
> explicitly if no user value has been set.
> 
> By putting this into the (renamed) boot time initialization of vmcs.c
> _vmx_cpu_up() can be made static.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

> ---
>  xen/arch/x86/hvm/vmx/vmcs.c        | 22 +++++++++++++++-------
>  xen/arch/x86/hvm/vmx/vmx.c         |  4 +---
>  xen/include/asm-x86/hvm/vmx/vmcs.h |  3 +--
>  3 files changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> index 4c23645454..221af9737a 100644
> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> @@ -315,10 +315,6 @@ static int vmx_init_vmcs_config(void)
> 
>          if ( !opt_ept_ad )
>              _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT;
> -        else if ( /* Work around Erratum AVR41 on Avoton processors. */
> -                  boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x4d
> &&
> -                  opt_ept_ad < 0 )
> -            _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT;
> 
>          /*
>           * Additional sanity checking before using EPT:
> @@ -652,7 +648,7 @@ void vmx_cpu_dead(unsigned int cpu)
>      vmx_pi_desc_fixup(cpu);
>  }
> 
> -int _vmx_cpu_up(bool bsp)
> +static int _vmx_cpu_up(bool bsp)
>  {
>      u32 eax, edx;
>      int rc, bios_locked, cpu = smp_processor_id();
> @@ -2108,9 +2104,21 @@ static void vmcs_dump(unsigned char ch)
>      printk("**************************************\n");
>  }
> 
> -void __init setup_vmcs_dump(void)
> +int __init vmx_vmcs_init(void)
>  {
> -    register_keyhandler('v', vmcs_dump, "dump VT-x VMCSs", 1);
> +    int ret;
> +
> +    if ( opt_ept_ad < 0 )
> +        /* Work around Erratum AVR41 on Avoton processors. */
> +        opt_ept_ad = !(boot_cpu_data.x86 == 6 &&
> +                       boot_cpu_data.x86_model == 0x4d);
> +
> +    ret = _vmx_cpu_up(true);
> +
> +    if ( !ret )
> +        register_keyhandler('v', vmcs_dump, "dump VT-x VMCSs", 1);
> +
> +    return ret;
>  }
> 
>  static void __init __maybe_unused build_assertions(void)
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index 6efa80e422..11a4dd94cf 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -2482,7 +2482,7 @@ const struct hvm_function_table * __init
> start_vmx(void)
>  {
>      set_in_cr4(X86_CR4_VMXE);
> 
> -    if ( _vmx_cpu_up(true) )
> +    if ( vmx_vmcs_init() )
>      {
>          printk("VMX: failed to initialise.\n");
>          return NULL;
> @@ -2553,8 +2553,6 @@ const struct hvm_function_table * __init
> start_vmx(void)
>          vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs;
>      }
> 
> -    setup_vmcs_dump();
> -
>      lbr_tsx_fixup_check();
>      bdf93_fixup_check();
> 
> diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-
> x86/hvm/vmx/vmcs.h
> index 95c1dea7b8..906810592f 100644
> --- a/xen/include/asm-x86/hvm/vmx/vmcs.h
> +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
> @@ -21,11 +21,10 @@
>  #include <xen/mm.h>
> 
>  extern void vmcs_dump_vcpu(struct vcpu *v);
> -extern void setup_vmcs_dump(void);
> +extern int vmx_vmcs_init(void);
>  extern int  vmx_cpu_up_prepare(unsigned int cpu);
>  extern void vmx_cpu_dead(unsigned int cpu);
>  extern int  vmx_cpu_up(void);
> -extern int  _vmx_cpu_up(bool bsp);
>  extern void vmx_cpu_down(void);
> 
>  struct vmcs_struct {
> --
> 2.26.1




 


Rackspace

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