From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baBc1-0007Ls-3l for qemu-devel@nongnu.org; Wed, 17 Aug 2016 20:55:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1baBbx-0006BN-3r for qemu-devel@nongnu.org; Wed, 17 Aug 2016 20:55:12 -0400 Date: Thu, 18 Aug 2016 10:57:04 +1000 From: David Gibson Message-ID: <20160818005704.GD3091@voom.fritz.box> References: <1471442498-8357-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="/3yNEOqWowh/8j+e" Content-Disposition: inline In-Reply-To: <1471442498-8357-1-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [FIX PATCH] spapr: Gracefully fail CPU thread unplug 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, imammedo@redhat.com, sbhat@linux.vnet.ibm.com --/3yNEOqWowh/8j+e Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 17, 2016 at 07:31:38PM +0530, Bharata B Rao wrote: > sPAPR supports only Core level CPU plug and unplug, but nothing > prevents user from issuing a device_del on the underlying thread > device by using its qom path directly. This hits g_assert(hotplug_ctrl) > in qdev_unplug(). >=20 > Gracefully reject such unplug requests from ->unplug() handler >=20 > Reported-by: Shivaprasad G Bhat > Signed-off-by: Bharata B Rao Why isn't there a graceful failure if we return NULL from the hotplug_handler()? Doesn't that indicate a bug in the generic code? Couldn't the same error be triggered by attempting to unplug some other random device - say the RTC on x86, or the NVRAM on POWER? Also I only just noticed that we've had a misspelling here for ages: "hotpug_handler". > --- > hw/ppc/spapr.c | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 30d6800..0e89d7d 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2344,6 +2344,9 @@ static void spapr_machine_device_unplug(HotplugHand= ler *hotplug_dev, > return; > } > spapr_core_unplug(hotplug_dev, dev, errp); > + } else { > + error_setg(errp, "Unplug not supported for device type: %s", > + object_get_typename(OBJECT(dev))); > } > } > =20 > @@ -2359,6 +2362,7 @@ static HotplugHandler *spapr_get_hotpug_handler(Mac= hineState *machine, > DeviceState *dev) > { > if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || > + object_dynamic_cast(OBJECT(dev), TYPE_CPU) || > object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_CPU_CORE)) { > return HOTPLUG_HANDLER(machine); > } --=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 --/3yNEOqWowh/8j+e Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXtQfgAAoJEGw4ysog2bOSVmoQAJgHDp02pML6FUOZhwCJ9RFD WB3z9BP4s+wK4oHER+FTCjA/lBu8YeLi8fETMkhRzw5CPH3q3u6ZAUF/Jdsi23Uw MrptPcxQlIY2aqoHrvvK1hDNJhEqdaY/ldckykVc1n1wdanZrDim/y60LKVHIYQN VLGS9Yf0wZvMzpUSC873bmSo91W/D21N0m5BUBH/jOlvmwM/ZZLDRCPfU5oeoqDW Ov0FngKnSm4oweJ6oIU794OEm7DZoyfDKfCwwH9EhjzY5MTLPaUKF7EvVqy4nRty 5Ap2HTvADX0yz7a6aMqvMQLKv6r250M9tFAj9eJmLCFeU/ObLUnjWW/2XPiJqKi/ Mc44VUTQvbw4axioZbk2RxyjxFvuERII8If2mKJAxUcgeO1npidmV52ok3n8w4K5 knioIaKAbH0fBniCOlK+UJiH0gc29HyZhplig/Q+gi8CNz59Q3KBTX7g/TKfXUnh JYjl6zQqn4G+BwCt2vXnleC9Fv0KZduFyeWpbENO7tqnfrol2E7ZxJCSmC3+nRqc /s8Z1M4cejuin+23owTEjwAW4LNU1tDxyNwO5Qzy7K6l0ULC8TKpSsSLTiunIVc5 JHr1kmC1N4VyMYzlyFLLyuFridCVqP4DXk77yASgH4sHbJPuyTK5BpjRxdFSmjE7 7fxlU5lsYr6A4TNEqdUL =iVWg -----END PGP SIGNATURE----- --/3yNEOqWowh/8j+e--