KVM: PPC: Book3S HV: Fix some races in starting secondary threads
commit7b444c6710c6c4994e31eb19216ce055836e65c4
authorPaul Mackerras <paulus@samba.org>
Mon, 15 Oct 2012 01:16:14 +0000 (15 01:16 +0000)
committerAlexander Graf <agraf@suse.de>
Tue, 30 Oct 2012 09:54:54 +0000 (30 10:54 +0100)
tree52dc3cea624002ca0cfc023b9336676850e6acbd
parent512691d4907d7cf4b8d05c6f8572d1fa60ccec20
KVM: PPC: Book3S HV: Fix some races in starting secondary threads

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: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S