From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJDQ9-0001AX-70 for qemu-devel@nongnu.org; Tue, 12 Jan 2016 23:52:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJDQ5-0004jJ-VL for qemu-devel@nongnu.org; Tue, 12 Jan 2016 23:52:33 -0500 Date: Wed, 13 Jan 2016 14:45:54 +1100 From: David Gibson Message-ID: <20160113034553.GZ22925@voom.redhat.com> References: <1452236119-24452-1-git-send-email-bharata@linux.vnet.ibm.com> <1452236119-24452-7-git-send-email-bharata@linux.vnet.ibm.com> <20160112041615.GN22925@voom.redhat.com> <20160112065302.GA11785@in.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u3gIr+u2NK768I+f" Content-Disposition: inline In-Reply-To: <20160112065302.GA11785@in.ibm.com> Subject: Re: [Qemu-devel] [PATCH v6 06/11] cpu: Add a sync version of cpu_remove() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: mdroth@linux.vnet.ibm.com, aik@ozlabs.ru, agraf@suse.de, qemu-devel@nongnu.org, pbonzini@redhat.com, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, imammedo@redhat.com, afaerber@suse.de, ehabkost@redhat.com --u3gIr+u2NK768I+f Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 12, 2016 at 12:23:03PM +0530, Bharata B Rao wrote: > On Tue, Jan 12, 2016 at 03:16:15PM +1100, David Gibson wrote: > > On Fri, Jan 08, 2016 at 12:25:14PM +0530, Bharata B Rao wrote: > > > This sync API will be used by the CPU hotplug code to wait for the CP= U to > > > completely get removed before flagging the failure to the device_add > > > command. > > >=20 > > > Sync version of this call is needed to correctly recover from CPU > > > realization failures when ->plug() handler fails. > > >=20 > > > Signed-off-by: Bharata B Rao > > > Reviewed-by: David Gibson > > > --- > > > cpus.c | 12 ++++++++++++ > > > include/qom/cpu.h | 8 ++++++++ > > > 2 files changed, 20 insertions(+) > > >=20 > > > diff --git a/cpus.c b/cpus.c > > > index 12374af..c829bd6 100644 > > > --- a/cpus.c > > > +++ b/cpus.c > > > @@ -1067,6 +1067,8 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) > > > qemu_kvm_wait_io_event(cpu); > > > if (cpu->exit && !cpu_can_run(cpu)) { > > > qemu_kvm_destroy_vcpu(cpu); > > > + cpu->created =3D false; > > > + qemu_cond_signal(&qemu_cpu_cond); > >=20 > > I know I reviewed this earlier, but I suspect this needs to be > > qemu_cond_broadcast. qemu_cpu_cond is global, so there could (at > > least in theory) be multiple things waiting on it, and we don't know > > which one is waiting on *this* cpu, rather than another one (or on any > > other condition handled by this qemu_cpu_cond). >=20 > qemu_cpu_cond condition variable is currently handling the CPU creation > condition where qemu_cond_signal() is being used. From what I understand, > only main thread will be waiting on this condition. > In this patch, I am using the same condition variable to track CPU > deletion condition too. After this too, I think only main thread will be > waiting for the deletion to get completed. So using qemu_cond_signal() > should be ok isn't ? Ok, if it's just waking the main thread, qemu_cond_signal() should be fine (in fact, equivalent to qemu_cond_broadcast()). --=20 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 --u3gIr+u2NK768I+f Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWlchxAAoJEGw4ysog2bOSBUAQAMSupMzAJr2ylqbkaWuVa3X+ mKabhT/YE+SlV6EgLE3wMr/g3U4p2qhvr3iXMW7KP8+Jm+GnYupR+P5RL4iuFAc4 WJKYgsXxKDRV74GB6gjt2VEcQHOJg7LVgNkpoWpu8o4jjQ2/nOsb/tpoUDI4N3q4 Es8OzLFdBs9G88RQaPM9hckJ/OryOcoGeY+G6dfQowjuZGDjomLvNrezf+bPDviE 5LLVLlnt3rNi1y1rosoLxdFqN8aENcfmFO6sCHAjdqcWPpt0AZAun8A/hrLGLWzM ce5SxMiMQsV1CjWib5QXrTzQ6M1NeszVi+EQfkuQjecXlmiTMM1xkLpYBW6ilu48 SPjCuPQDtaf6WU+tGycy883qyCdD2/tr6Yns4QkAuQ5PjA9nL/1ZqMqhFERCdwoF iw6n18hLoZczls4LPqTlIz6jxfSaEoG0vcyEoVV7XwTdgzsi55q0ELAKtR0tKKlb uXK2MkXKRLUAvbNoIo5oZC25y7hoCkLOeMfcMVLXa+e6LzOMHZVeU2pMxP9R0NNk dYUnnBL8adSrftwDEpWmNKg8HOXQ6YqYyGr+5arhVMIkfQbLePMD6Z46AkAYXR7I c5nZwCUZpM2pV6SmJ2RKZfcggFyh/fwSOEcJCCkfTRzJGnpRouIdO+q+6e1HR93J fRiollSWILynxKfJccCK =pHCE -----END PGP SIGNATURE----- --u3gIr+u2NK768I+f--