From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKx7j-0002WU-DK for qemu-devel@nongnu.org; Wed, 06 Jul 2016 20:25:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKx7f-00007M-4Z for qemu-devel@nongnu.org; Wed, 06 Jul 2016 20:24:58 -0400 Date: Thu, 7 Jul 2016 10:10:51 +1000 From: David Gibson Message-ID: <20160707001051.GC2615@voom.fritz.box> References: <1467827370-8808-1-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="p2kqVDKq5asng8Dg" Content-Disposition: inline In-Reply-To: <1467827370-8808-1-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v0] spapr: Error out when CPU hotplug is attempted on older pseries machines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org --p2kqVDKq5asng8Dg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 06, 2016 at 11:19:30PM +0530, Bharata B Rao wrote: > CPU hotplug and coldplug aren't supported prior to pseries-2.7. > query-hotpluggable-cpus and coldplug on older pseries machines are crashi= ng > the QEMU. Fix this. >=20 > - Let query_hotpluggable_cpus return NULL for pseries < 2.7 > - spapr_core_pre_plug() should fail hot/cold plug attempts for pseries < = 2.7 > - spapr_core_plug() should never be called for pseries < 2.7, hence use > an assert. >=20 > Signed-off-by: Bharata B Rao > --- > Applies on ppc-for-2.7 branch of David's tree. Applied to ppc-for-2.7. >=20 > hw/ppc/spapr.c | 5 +++++ > hw/ppc/spapr_cpu_core.c | 19 ++++++------------- > 2 files changed, 11 insertions(+), 13 deletions(-) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 7f33a1b..e3a7912 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2368,9 +2368,14 @@ static HotpluggableCPUList *spapr_query_hotpluggab= le_cpus(MachineState *machine) > int i; > HotpluggableCPUList *head =3D NULL; > sPAPRMachineState *spapr =3D SPAPR_MACHINE(machine); > + sPAPRMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(machine); > int spapr_max_cores =3D max_cpus / smp_threads; > int smt =3D kvmppc_smt_threads(); > =20 > + if (!smc->dr_cpu_enabled) { > + return NULL; > + } > + > for (i =3D 0; i < spapr_max_cores; i++) { > HotpluggableCPUList *list_item =3D g_new0(typeof(*list_item), 1); > HotpluggableCPU *cpu_item =3D g_new0(typeof(*cpu_item), 1); > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > index 70b6b0b..273207c 100644 > --- a/hw/ppc/spapr_cpu_core.c > +++ b/hw/ppc/spapr_cpu_core.c > @@ -162,19 +162,12 @@ void spapr_core_plug(HotplugHandler *hotplug_dev, D= eviceState *dev, > int index; > int smt =3D kvmppc_smt_threads(); > =20 > + g_assert(smc->dr_cpu_enabled); > + > drc =3D spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cc->co= re_id); > index =3D cc->core_id / smt; > spapr->cores[index] =3D OBJECT(dev); > =20 > - if (!smc->dr_cpu_enabled) { > - /* > - * This is a cold plugged CPU core but the machine doesn't suppo= rt > - * DR. So skip the hotplug path ensuring that the core is brought > - * up online with out an associated DR connector. > - */ > - return; > - } > - > g_assert(drc); > =20 > /* > @@ -223,13 +216,13 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_de= v, DeviceState *dev, > char *base_core_type =3D spapr_get_cpu_core_type(machine->cpu_model); > const char *type =3D object_get_typename(OBJECT(dev)); > =20 > - if (strcmp(base_core_type, type)) { > - error_setg(&local_err, "CPU core type should be %s", base_core_t= ype); > + if (!smc->dr_cpu_enabled) { > + error_setg(&local_err, "CPU hotplug not supported for this machi= ne"); > goto out; > } > =20 > - if (!smc->dr_cpu_enabled && dev->hotplugged) { > - error_setg(&local_err, "CPU hotplug not supported for this machi= ne"); > + if (strcmp(base_core_type, type)) { > + error_setg(&local_err, "CPU core type should be %s", base_core_t= ype); > goto out; > } > =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 --p2kqVDKq5asng8Dg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXfZ4LAAoJEGw4ysog2bOSmg4QALXSCtlZ646oLVmBH3pYgUy+ P3BIC85Htn9q1olAItChznfAs0EYqnpYbocCny63NAMQEaYvUEYX57YoybxzlDDg MW8PaeKe97DYaA+b5pz1vZoEILvqrFhik+WZESkpSVR2PX3XzG6Akx8K/mB/W6ED F2YtDErtNcaIEaQxxo+dwGkbFHPQHBUavFk5At9vTgKPvRNCpzdQ2SDuVvmvSflu Zq2fOutweUOLnO/oN9WDzZ0ZLL9AQ7W3fOftN0+V5HwBDJX1EKtEnkp9hJWkPqpx hLzREo8hd21ungbRrbmyKxpsJ0iE5NZMe9lK8PDBMutZtfVHoyeEU14nPgARiMtH hVBO7TKhdlSz32Xeb1eR7GtWJ4MdnXEx2mihQIt1OqQJ6VbobFpduSOV/HA6lJx3 oheIOW7rHYRenchuWawC86fvE/DM6iBp4opoBN+/H6y6GbBmNuT2+BS3SKpixPi5 VyM7g/RuiuhF54fLAtEHzKyC0l9mAnGmqes2TXAIg6kjzkCSWF426Zshxmsm65GR DBpyI7r69n9Kzn2fWQKgSBuQQAGXQINPr4Eue2JSIsusTHox4mY/xOoZQZzMNavK GaYJRUuq2WZzWt6oLTecSaQemEMm+kbjhlwbAvyIyWkQWhuzmP2ZJ+vh0tBd4bdc zbSYZSI9E4OPKWF9vKoq =QVUI -----END PGP SIGNATURE----- --p2kqVDKq5asng8Dg--