• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Fix some races in starting secondary threads · 7b444c67
    Paul Mackerras authored
    Subsequent patches implementing in-kernel XICS emulation will make it
    possible for IPIs to arrive at secondary threads at arbitrary times.
    This fixes some races in how we start the secondary threads, which
    if not fixed could lead to occasional crashes of the host kernel.
    
    This makes sure that (a) we have grabbed all the secondary threads,
    and verified that they are no longer in the kernel, before we start
    any thread, (b) that the secondary thread loads its vcpu pointer
    after clearing the IPI that woke it up (so we don't miss a wakeup),
    and (c) that the secondary thread clears its vcpu pointer before
    incrementing the nap count.  It also removes unnecessary setting
    of the vcpu and vcore pointers in the paca in kvmppc_core_vcpu_load.
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
    7b444c67
book3s_hv.c 44.2 KB