From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba1Q1-0008Bw-Kb for qemu-devel@nongnu.org; Wed, 17 Aug 2016 10:02:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ba1Px-00010H-Lt for qemu-devel@nongnu.org; Wed, 17 Aug 2016 10:02:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51614 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ba1Px-00010A-Ft for qemu-devel@nongnu.org; Wed, 17 Aug 2016 10:02:05 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7HDc9lN024442 for ; Wed, 17 Aug 2016 10:02:04 -0400 Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) by mx0b-001b2d01.pphosted.com with ESMTP id 24vrm32ct3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 17 Aug 2016 10:02:04 -0400 Received: from localhost by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Aug 2016 00:02:00 +1000 From: Bharata B Rao Date: Wed, 17 Aug 2016 19:31:38 +0530 Message-Id: <1471442498-8357-1-git-send-email-bharata@linux.vnet.ibm.com> Subject: [Qemu-devel] [FIX PATCH] spapr: Gracefully fail CPU thread unplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, imammedo@redhat.com, sbhat@linux.vnet.ibm.com, Bharata B Rao 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 --- hw/ppc/spapr.c | 4 ++++ 1 file changed, 4 insertions(+) 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(HotplugHandler *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))); } } @@ -2359,6 +2362,7 @@ static HotplugHandler *spapr_get_hotpug_handler(MachineState *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); } -- 2.7.4