Received: from eggs.gnu.org ([2001:4830:134:3::10]:57782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjQfQ-0004nK-Cm for qemu-devel@nongnu.org; Mon, 12 Sep 2016 08:48:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjQfL-00021y-9j for qemu-devel@nongnu.org; Mon, 12 Sep 2016 08:48:55 -0400 Date: Mon, 12 Sep 2016 14:48:47 +0200 From: Igor Mammedov Message-ID: <20160912144847.433c9601@nial.brq.redhat.com> In-Reply-To: <20160818102045.GB5376@in.ibm.com> References: <1471442498-8357-1-git-send-email-bharata@linux.vnet.ibm.com> <20160818005704.GD3091@voom.fritz.box> <20160818102045.GB5376@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Change the condition that permits to use device_del QOM-path on device? was (spapr: Gracefully fail CPU thread unplug) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: David Gibson , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, sbhat@linux.vnet.ibm.com, berrange@redhat.com, eblake@redhat.com, armbru@redhat.com On Thu, 18 Aug 2016 15:50:45 +0530 Bharata B Rao wrote: > On Thu, Aug 18, 2016 at 10:57:04AM +1000, David Gibson wrote: > > 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(). > > > > > > Gracefully reject such unplug requests from ->unplug() handler > > > > > > 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? > > True, realized that this error can be triggered for other devices as well > like dr-connector or icp devices. So it definitely doesn't make sense > to explicitly return a non-NULL hotplug_handler for all of these > and then fail the unplug gracefully from ->unplug() like I am doing here > for CPU thread devices. > > Hence, this particular fix isn't needed right now. May be we can gracefully > error out for all such cases from qdev_unplug(). device_del by QOM path was discussed here: https://patchwork.ozlabs.org/patch/516781/ but it only takes Device::hotpluggable into account, perhaps we should add something like DeviceClass::cannot_delete_device_del in addition to above? > > Regards, > Bharata. >