]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Remove redundant is_tdp_mmu_enabled check
authorDavid Matlack <dmatlack@google.com>
Thu, 17 Jun 2021 23:19:46 +0000 (23:19 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 18 Jun 2021 10:45:46 +0000 (06:45 -0400)
commited8f928c6715cec0420e19b7f3cd12f21bdf3cc3
tree0a8a768eaa17782bf54852d0b95f91f16c654de6
parent87d898e61353e107a2b86fa09d92493526ef26f5
KVM: x86/mmu: Remove redundant is_tdp_mmu_enabled check

This check is redundant because the root shadow page will only be a TDP
MMU page if is_tdp_mmu_enabled() returns true, and is_tdp_mmu_enabled()
never changes for the lifetime of a VM.

It's possible that this check was added for performance reasons but it
is unlikely that it is useful in practice since to_shadow_page() is
cheap. That being said, this patch also caches the return value of
is_tdp_mmu_root() in direct_page_fault() since there's no reason to
duplicate the call so many times, so performance is not a concern.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20210617231948.2591431-3-dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/tdp_mmu.h