lkml.org 
[lkml]   [2022]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v3] KVM: SEV: Mark nested locking of vcpu->lock
    From
    On 4/30/22 03:50, Hillf Danton wrote:
    > lock for migration
    > ===
    > kvm_for_each_vcpu(i, vcpu, kvm) {
    > if (mutex_lock_killable(&vcpu->mutex))
    > goto out_unlock;
    > lockdep_copy_map(&vcpu->v_dep_map, &vcpu->mutex.dep_map);
    > mutex_release(&vcpu->mutex.dep_map, ip);
    > }
    >
    >
    > unlock for migration
    > ===
    > kvm_for_each_vcpu(i, vcpu, kvm) {
    > lockdep_copy_map(&vcpu->mutex.dep_map, &vcpu->v_dep_map);
    > /*
    > * Or directly acquire without v_dep_map added
    > *
    > mutex_acquire(&vcpu->mutex.dep_map, 0, 1,_RET_IP_);
    > */
    > mutex_unlock(&vcpu->mutex);
    > }

    Yes this is exactly what Peter is doing, except that we're trying to
    keep one lock taken. Thanks for pointing to lock_sock_nested().

    Paolo

    \
     
     \ /
      Last update: 2022-04-30 10:13    [W:2.550 / U:0.056 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site