From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXkMN-0002OL-Vp for qemu-devel@nongnu.org; Fri, 04 Sep 2015 02:20:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXkMK-0005my-Ih for qemu-devel@nongnu.org; Fri, 04 Sep 2015 02:20:27 -0400 Date: Fri, 4 Sep 2015 16:03:43 +1000 From: David Gibson Message-ID: <20150904060343.GW6537@voom.redhat.com> References: <1438838837-28504-1-git-send-email-bharata@linux.vnet.ibm.com> <1438838837-28504-3-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="m9FEOsnejx470nED" Content-Disposition: inline In-Reply-To: <1438838837-28504-3-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v4 02/11] exec: Do vmstate unregistration from cpu_exec_exit() 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, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, imammedo@redhat.com, afaerber@suse.de --m9FEOsnejx470nED Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 06, 2015 at 10:57:08AM +0530, Bharata B Rao wrote: > cpu_exec_init() does vmstate_register and register_savevm for the CPU dev= ice. > These need to be undone from cpu_exec_exit(). These changes are needed to > support CPU hot removal and also to correctly fail hotplug attempts > beyond max_cpus. >=20 > Signed-off-by: Bharata B Rao As with 1/2, looks reasonable, but I'm wondering how x86 hotplug is getting away without this. > --- > exec.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) >=20 > diff --git a/exec.c b/exec.c > index b196d68..3415cd7 100644 > --- a/exec.c > +++ b/exec.c > @@ -545,6 +545,8 @@ static int cpu_get_free_index(Error **errp) > =20 > void cpu_exec_exit(CPUState *cpu) > { > + CPUClass *cc =3D CPU_GET_CLASS(cpu); > + > if (cpu->cpu_index =3D=3D -1) { > /* cpu_index was never allocated by this @cpu or was already fre= ed. */ > return; > @@ -556,6 +558,15 @@ void cpu_exec_exit(CPUState *cpu) > } > bitmap_clear(cpu_index_map, cpu->cpu_index, 1); > cpu->cpu_index =3D -1; > + if (cc->vmsd !=3D NULL) { > + vmstate_unregister(NULL, cc->vmsd, cpu); > + } > +#if defined(CPU_SAVE_VERSION) > + unregister_savevm(NULL, "cpu", cpu->env_ptr); > +#endif > + if (qdev_get_vmsd(DEVICE(cpu)) =3D=3D NULL) { > + vmstate_unregister(NULL, &vmstate_cpu_common, cpu); > + } > } > #else > =20 > @@ -572,12 +583,20 @@ static int cpu_get_free_index(Error **errp) > =20 > void cpu_exec_exit(CPUState *cpu) > { > + CPUClass *cc =3D CPU_GET_CLASS(cpu); > + > cpu_list_lock(); > if (cpu->queued) { > QTAILQ_REMOVE(&cpus, cpu, node); > cpu->queued =3D false; > } > cpu_list_unlock(); > + if (cc->vmsd !=3D NULL) { > + vmstate_unregister(NULL, cc->vmsd, cpu); > + } > + if (qdev_get_vmsd(DEVICE(cpu)) =3D=3D NULL) { > + vmstate_unregister(NULL, &vmstate_cpu_common, cpu); > + } > } > #endif > =20 --=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 --m9FEOsnejx470nED Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJV6TQ/AAoJEGw4ysog2bOSUBQQAOXXYM2PaHe5RczocR/copZ8 5KUyNXA1DneQ0TG7ubL2h2I02dwxT1y0Gts522whd2qJFyZTNtdZp53NTG71zAcU XWK43D3uBEGHTQzGjpKaNHKZK3PZXA6EkGwRamP2fjIy2D6pd5cPrrIJ0tqbRv7x tuxZideSPU+l8ceHMp8rTNOCaiE6S39iyUiDe/gFCWgf5ih4nB2iydLb7sXK3Viz m8ZfaLTi3ZDxhozBs6EKHZeJLfivE7emKVtJQqHo5r3v9yMilRNMoPQ/df8QDiXs mZXdrrOF8KbzL5Qm1cWX3UfGxiovsrk2zrGe6UYpgQln5aMG9RSKpqbOSYF1vyhd RQjtk+IYWTnyV6SABwpgeEFuhT4kORg7Zzh6i7lTIzJnAvRK4HBL83faUtthXA+V SGRMNp9f0C2zlu3DkT+F53ML4i5g+GuNaEoxutXpljLoMzoyo5ZqtB7KiVuAdvU/ vtRYvcwtO0jE3rGTmCZyDsCmyH6Ues+/YU23Wodl31GfkIACHht883kb/OVbbjrr 1Lm/QibSWhqFwuZcuGfpORVJaMUMSeGdCkr5+am11l+jSvV9C/8JSV/PqIWjMpiC a/FvItiJpRpAorusq/mTRgrhme7e7v9QV814/RtrGYJgizN2sy0+7JLv/VZBsKUG wkrj3iHisd7hkyTHtkgH =MmvQ -----END PGP SIGNATURE----- --m9FEOsnejx470nED--