* Re: [PATCH 1/2] KVM: PPC: Book3S HV: Fix race in starting secondary threads [not found] <20150903052050.GA4377@iris.ozlabs.ibm.com> @ 2015-09-03 5:31 ` David Gibson 0 siblings, 0 replies; 2+ messages in thread From: David Gibson @ 2015-09-03 5:31 UTC (permalink / raw) To: Paul Mackerras; +Cc: kvm, kvm-ppc [-- Attachment #1: Type: text/plain, Size: 1759 bytes --] On Thu, Sep 03, 2015 at 03:20:50PM +1000, Paul Mackerras wrote: > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> > > The current dynamic micro-threading code has a race due to which a > secondary thread naps when it is supposed to be running a vcpu. As a > side effect of this, on a guest exit, the primary thread in > kvmppc_wait_for_nap() finds that this secondary thread hasn't cleared > its vcore pointer. This results in "CPU X seems to be stuck!" > warnings. > > The race is possible since the primary thread on exiting the guests > only waits for all the secondaries to clear its vcore pointer. It > subsequently expects the secondary threads to enter nap while it > unsplits the core. A secondary thread which hasn't yet entered the nap > will loop in kvm_no_guest until its vcore pointer and the do_nap flag > are unset. Once the core has been unsplit, a new vcpu thread can grab > the core and set the do_nap flag *before* setting the vcore pointers > of the secondary. As a result, the secondary thread will now enter nap > via kvm_unsplit_nap instead of running the guest vcpu. > > Fix this by setting the do_nap flag after setting the vcore pointer in > the PACA of the secondary in kvmppc_run_core. Also, ensure that a > secondary thread doesn't nap in kvm_unsplit_nap when the vcore pointer > in its PACA struct is set. > > Fixes: b4deba5c41e9 > Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com> > Signed-off-by: Paul Mackerras <paulus@samba.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] KVM: PPC: Book3S HV: Fix race in starting secondary threads @ 2015-09-03 5:31 ` David Gibson 0 siblings, 0 replies; 2+ messages in thread From: David Gibson @ 2015-09-03 5:31 UTC (permalink / raw) To: Paul Mackerras; +Cc: kvm, kvm-ppc [-- Attachment #1: Type: text/plain, Size: 1759 bytes --] On Thu, Sep 03, 2015 at 03:20:50PM +1000, Paul Mackerras wrote: > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> > > The current dynamic micro-threading code has a race due to which a > secondary thread naps when it is supposed to be running a vcpu. As a > side effect of this, on a guest exit, the primary thread in > kvmppc_wait_for_nap() finds that this secondary thread hasn't cleared > its vcore pointer. This results in "CPU X seems to be stuck!" > warnings. > > The race is possible since the primary thread on exiting the guests > only waits for all the secondaries to clear its vcore pointer. It > subsequently expects the secondary threads to enter nap while it > unsplits the core. A secondary thread which hasn't yet entered the nap > will loop in kvm_no_guest until its vcore pointer and the do_nap flag > are unset. Once the core has been unsplit, a new vcpu thread can grab > the core and set the do_nap flag *before* setting the vcore pointers > of the secondary. As a result, the secondary thread will now enter nap > via kvm_unsplit_nap instead of running the guest vcpu. > > Fix this by setting the do_nap flag after setting the vcore pointer in > the PACA of the secondary in kvmppc_run_core. Also, ensure that a > secondary thread doesn't nap in kvm_unsplit_nap when the vcore pointer > in its PACA struct is set. > > Fixes: b4deba5c41e9 > Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com> > Signed-off-by: Paul Mackerras <paulus@samba.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-03 5:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20150903052050.GA4377@iris.ozlabs.ibm.com>
2015-09-03 5:31 ` [PATCH 1/2] KVM: PPC: Book3S HV: Fix race in starting secondary threads David Gibson
2015-09-03 5:31 ` David Gibson
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.