lkml.org 
[lkml]   [2021]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 5/6] KVM: x86/mmu: Protect kvm->memslots with a mutex
Date
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

\
 
 \ /
  Last update: 2021-04-28 08:26    [W:0.104 / U:2.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site