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-next>] [day] [month] [year] [list]
Message-ID: <CAPm50aLYb9+wsm3WA8buhC+ePfR6TrGbDR0nMju+bLzf0Tozuw@mail.gmail.com>
Date:   Tue, 26 Jul 2022 09:59:42 +0800
From:   Hao Peng <flyingpenghao@...il.com>
To:     pbonzini@...hat.com
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Sean Christopherson <seanjc@...gle.com>
Subject: [PATCH] kvm: mmu: Simplify judgment conditions

From: Peng Hao <flyingpeng@...cent.com>

kvm_shadow_root_allocated() has been checked before in
mmu_first_shadow_root_alloc,
and subsequent kvm_memslots_have_rmaps() does not need to check
kvm_shadow_root_allocated() again.

Signed-off-by: Peng Hao <flyingpeng@...cent.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 52664c3caaab..ecd64c06f839 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -3584,7 +3584,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;

--
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ