Received: from eggs.gnu.org ([2001:4830:134:3::10]:50214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baKRh-0000wW-FE for qemu-devel@nongnu.org; Thu, 18 Aug 2016 06:21:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1baKRX-0005qs-4u for qemu-devel@nongnu.org; Thu, 18 Aug 2016 06:21:08 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:25073 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baKRW-0005qo-Uj for qemu-devel@nongnu.org; Thu, 18 Aug 2016 06:20:59 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7IAIjSd000799 for ; Thu, 18 Aug 2016 06:20:58 -0400 Received: from e28smtp06.in.ibm.com (e28smtp06.in.ibm.com [125.16.236.6]) by mx0b-001b2d01.pphosted.com with ESMTP id 24vmf1a968-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 18 Aug 2016 06:20:58 -0400 Received: from localhost by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Aug 2016 15:50:54 +0530 Date: Thu, 18 Aug 2016 15:50:45 +0530 From: Bharata B Rao Reply-To: bharata@linux.vnet.ibm.com References: <1471442498-8357-1-git-send-email-bharata@linux.vnet.ibm.com> <20160818005704.GD3091@voom.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160818005704.GD3091@voom.fritz.box> Message-Id: <20160818102045.GB5376@in.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: David Gibson Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, imammedo@redhat.com, sbhat@linux.vnet.ibm.com 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(). Regards, Bharata.