KVM: x86/mmu: always take tdp_mmu_pages_lock
authorPaolo Bonzini <pbonzini@redhat.com>
Sat, 25 Nov 2023 08:33:59 +0000 (03:33 -0500)
committerSean Christopherson <seanjc@google.com>
Fri, 1 Dec 2023 15:52:08 +0000 (07:52 -0800)
commit250ce1b4d21a94f910c3df5141ff6434ea92524e
treee04b9c330262a9edbb83ce90a729ee8f200ab279
parent484dd27c0602e01cb49db362ad42b95e70912d43
KVM: x86/mmu: always take tdp_mmu_pages_lock

It is cheap to take tdp_mmu_pages_lock in all write-side critical sections.
We already do it all the time when zapping with read_lock(), so it is not
a problem to do it from the kvm_tdp_mmu_zap_all() path (aka
kvm_arch_flush_shadow_all(), aka VM destruction and MMU notifier release).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Link: https://lore.kernel.org/r/20231125083400.1399197-4-pbonzini@redhat.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Documentation/virt/kvm/locking.rst
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu/tdp_mmu.c