public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: mmu: Simplify judgment conditions
@ 2022-07-26  1:59 Hao Peng
  2022-07-26 14:41 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: Hao Peng @ 2022-07-26  1:59 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, linux-kernel, Sean Christopherson

From: Peng Hao <flyingpeng@tencent.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@tencent.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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-26 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26  1:59 [PATCH] kvm: mmu: Simplify judgment conditions Hao Peng
2022-07-26 14:41 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox