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]
Message-ID: <c31a5f84-6da2-c6a0-c0cd-9f6802c39fc3@redhat.com>
Date:   Fri, 8 Apr 2022 12:10:33 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     luofei <luofei@...cloud.com>, tglx@...utronix.de, mingo@...hat.com,
        bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org
Cc:     seanjc@...gle.com, vkuznets@...hat.com, wanpengli@...cent.com,
        jmattson@...gle.com, joro@...tes.org, hpa@...or.com,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86/mmu: remove unnecessary
 kvm_shadow_root_allocated() check

On 4/7/22 03:40, luofei wrote:
> When we reach here, the return value of kvm_shadow_root_allocated()
> has already been checked to false under kvm->slots_arch_lock.
> So remove the unnecessary recheck.

It's a little less clear t check !is_tdp_mmu_enabled().

That said, this is only done once, so perhaps it's better/easier to just 
remove the if completely.

Paolo


> Signed-off-by: luofei <luofei@...cloud.com>
> ---
>   arch/x86/kvm/mmu/mmu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 8f19ea752704..1978ee527298 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -3394,7 +3394,7 @@ static int mmu_first_shadow_root_alloc(struct kvm *kvm)
>   	 * Check if anything actually needs to be allocated, e.g. all metadata
>   	 * will be allocated upfront if TDP is disabled.
>   	 */
> -	if (kvm_memslots_have_rmaps(kvm) &&
> +	if (!is_tdp_mmu_enabled(kvm) &&
>   	    kvm_page_track_write_tracking_enabled(kvm))
>   		goto out_success;
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ