Re: [PATCH 5/6] KVM: x86/mmu: Protect kvm->memslots with a mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/04/21 00:36, Ben Gardon wrote:
+void kvm_arch_assign_memslots(struct kvm *kvm, int as_id,
+			     struct kvm_memslots *slots)
+{
+	mutex_lock(&kvm->arch.memslot_assignment_lock);
+	rcu_assign_pointer(kvm->memslots[as_id], slots);
+	mutex_unlock(&kvm->arch.memslot_assignment_lock);
+}

Does the assignment also needs the lock, or only the rmap allocation? I would prefer the hook to be something like kvm_arch_setup_new_memslots.

(Also it is useful to have a comment somewhere explaining why the slots_lock does not work. IIUC there would be a deadlock because you'd be taking the slots_lock inside an SRCU critical region, while usually the slots_lock critical section is the one that includes a synchronize_srcu; I should dig that up and document that ordering in Documentation/virt/kvm too).

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux