• Paul Mackerras's avatar
    KVM: PPC: Book3s HV: Don't access runnable threads list without vcore lock · 913d3ff9
    Paul Mackerras authored
    There were a few places where we were traversing the list of runnable
    threads in a virtual core, i.e. vc->runnable_threads, without holding
    the vcore spinlock.  This extends the places where we hold the vcore
    spinlock to cover everywhere that we traverse that list.
    
    Since we possibly need to sleep inside kvmppc_book3s_hv_page_fault,
    this moves the call of it from kvmppc_handle_exit out to
    kvmppc_vcpu_run, where we don't hold the vcore lock.
    
    In kvmppc_vcore_blocked, we don't actually need to check whether
    all vcpus are ceded and don't have any pending exceptions, since the
    caller has already done that.  The caller (kvmppc_run_vcpu) wasn't
    actually checking for pending exceptions, so we add that.
    
    The change of if to while in kvmppc_run_vcpu is to make sure that we
    never call kvmppc_remove_runnable() when the vcore state is RUNNING or
    EXITING.
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
    913d3ff9
kvm_asm.h 4.5 KB