lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 8 Aug 2021 14:30:59 -0500
From:   Wei Huang <wei.huang2@....com>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        pbonzini@...hat.com, vkuznets@...hat.com, wanpengli@...cent.com,
        jmattson@...gle.com, joro@...tes.org, tglx@...utronix.de,
        mingo@...hat.com, bp@...en8.de, x86@...nel.org, hpa@...or.com
Subject: Re: [PATCH v1 1/3] KVM: x86: Convert TDP level calculation to
 vendor's specific code



On 8/5/21 4:51 PM, Sean Christopherson wrote:
> 
> If we want to keep the MAXPHYADDR behavior, I'd vote for something like:
> 
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index b4b65c21b2ca..7e35f2bf89b4 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -97,6 +97,7 @@ module_param_named(flush_on_reuse, force_flush_and_sync_on_reuse, bool, 0644);
>   bool tdp_enabled = false;
> 
>   static int max_huge_page_level __read_mostly;
> +static int tdp_root_level __read_mostly;
>   static int max_tdp_level __read_mostly;
> 
>   enum {
> @@ -4645,6 +4646,9 @@ static union kvm_mmu_role kvm_calc_mmu_role_common(struct kvm_vcpu *vcpu,
> 
>   static inline int kvm_mmu_get_tdp_level(struct kvm_vcpu *vcpu)
>   {
> +       if (tdp_root_level)
> +               return tdp_root_level;
> +
>          /* Use 5-level TDP if and only if it's useful/necessary. */
>          if (max_tdp_level == 5 && cpuid_maxphyaddr(vcpu) <= 48)
>                  return 4;
> @@ -5336,10 +5340,11 @@ void kvm_mmu_invpcid_gva(struct kvm_vcpu *vcpu, gva_t gva, unsigned long pcid)
>           */
>   }
> 
> -void kvm_configure_mmu(bool enable_tdp, int tdp_max_root_level,
> -                      int tdp_huge_page_level)
> +void kvm_configure_mmu(bool enable_tdp, int tdp_forced_root_level,
> +                      int tdp_max_root_level, int tdp_huge_page_level)
>   {
>          tdp_enabled = enable_tdp;
> +       tdp_root_level = tdp_forced_root_level;
>          max_tdp_level = tdp_max_root_level;
> 
>          /*
> 

I decided to take this suggestion in v2: it avoids using 5-level table 
(memory cost and potential table-walk overhead) if the host has the 
flexibility of using 4-level NPT under LA57.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ