KVM: mmu: Add slots_arch_lock for memslot arch fields
Add a new lock to protect the arch-specific fields of memslots if they need to be modified in a kvm->srcu read critical section. A future commit will use this lock to lazily allocate memslot rmaps for x86. Signed-off-by: Ben Gardon <bgardon@google.com> Message-Id: <20210518173414.450044-5-bgardon@google.com> [Add Documentation/ hunk. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
ddc12f2a12
commit
b10a038e84
@@ -523,6 +523,15 @@ struct kvm {
|
||||
#endif /* KVM_HAVE_MMU_RWLOCK */
|
||||
|
||||
struct mutex slots_lock;
|
||||
|
||||
/*
|
||||
* Protects the arch-specific fields of struct kvm_memory_slots in
|
||||
* use by the VM. To be used under the slots_lock (above) or in a
|
||||
* kvm->srcu critical section where acquiring the slots_lock would
|
||||
* lead to deadlock with the synchronize_srcu in
|
||||
* install_new_memslots.
|
||||
*/
|
||||
struct mutex slots_arch_lock;
|
||||
struct mm_struct *mm; /* userspace tied to this vm */
|
||||
struct kvm_memslots __rcu *memslots[KVM_ADDRESS_SPACE_NUM];
|
||||
struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
|
||||
|
||||
Reference in New Issue
Block a user