aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.h
diff options
context:
space:
mode:
authorBen Gardon <bgardon@google.com>2021-05-18 10:34:13 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2021-06-17 13:09:26 -0400
commite2209710ccc5d28d8b88c822d2f3e03b269a2856 (patch)
treef198fad36374a91f85df2e836f1f30c1b226e1fe /arch/x86/kvm/mmu.h
parentKVM: x86/mmu: Add a field to control memslot rmap allocation (diff)
downloadlinux-dev-e2209710ccc5d28d8b88c822d2f3e03b269a2856.tar.xz
linux-dev-e2209710ccc5d28d8b88c822d2f3e03b269a2856.zip
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>
Diffstat (limited to 'arch/x86/kvm/mmu.h')
-rw-r--r--arch/x86/kvm/mmu.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index 88d0ed5225a4..af09c47b1aa2 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -232,4 +232,9 @@ int kvm_arch_write_log_dirty(struct kvm_vcpu *vcpu);
int kvm_mmu_post_init_vm(struct kvm *kvm);
void kvm_mmu_pre_destroy_vm(struct kvm *kvm);
+static inline bool kvm_memslots_have_rmaps(struct kvm *kvm)
+{
+ return kvm->arch.memslots_have_rmaps;
+}
+
#endif