KVM: x86/mmu: Skip rmap operations if rmaps not allocated
authorBen Gardon <bgardon@google.com>
Tue, 18 May 2021 17:34:13 +0000 (10:34 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 17 Jun 2021 17:09:26 +0000 (13:09 -0400)
commite2209710ccc5d28d8b88c822d2f3e03b269a2856
treef198fad36374a91f85df2e836f1f30c1b226e1fe
parenta255740876f006eb9041fadcc4750557d26add5f
KVM: x86/mmu: Skip rmap operations if rmaps not allocated

If only the TDP MMU is being used to manage the memory mappings for a VM,
then many rmap operations can be skipped as they are guaranteed to be
no-ops. This saves some time which would be spent on the rmap operation.
It also avoids acquiring the MMU lock in write mode for many operations.

This makes it safe to run the VM without rmaps allocated, when only
using the TDP MMU and sets the stage for waiting to allocate the rmaps
until they're needed.

Signed-off-by: Ben Gardon <bgardon@google.com>
Message-Id: <20210518173414.450044-7-bgardon@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.h
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/x86.c