• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Call kvmppc_handle_exit_hv() with vcore unlocked · 53655ddd
    Paul Mackerras authored
    Currently kvmppc_handle_exit_hv() is called with the vcore lock held
    because it is called within a for_each_runnable_thread loop.
    However, we already unlock the vcore within kvmppc_handle_exit_hv()
    under certain circumstances, and this is safe because (a) any vcpus
    that become runnable and are added to the runnable set by
    kvmppc_run_vcpu() have their vcpu->arch.trap == 0 and can't actually
    run in the guest (because the vcore state is VCORE_EXITING), and
    (b) for_each_runnable_thread is safe against addition or removal
    of vcpus from the runnable set.
    
    Therefore, in order to simplify things for following patches, let's
    drop the vcore lock in the for_each_runnable_thread loop, so
    kvmppc_handle_exit_hv() gets called without the vcore lock held.
    Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    53655ddd
book3s_hv.c 118 KB