From nobody Wed Nov 5 18:39:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536305879386598.2631596582246; Fri, 7 Sep 2018 00:37:59 -0700 (PDT) Received: from localhost ([::1]:37138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBL3-0004Fa-SZ for importer@patchew.org; Fri, 07 Sep 2018 03:37:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFr-0000FY-F5 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFp-0005Je-RC for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:35 -0400 Received: from ozlabs.org ([203.11.71.1]:33531) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFp-00055K-EN; Fri, 07 Sep 2018 03:32:33 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jz1f07z9shq; Fri, 7 Sep 2018 17:32:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305523; bh=YBaN0IYumL8PwXEoxk00buwcMjl6we/z5oJcVR7aTx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NM5ZXMCH5C4Wv+eZCd86Et0kB4v719Vj5H8iuzTVO6EA8HCvZ7LDFJTpH4eYWkA2R nrnk6VatIaMcd37Kh+WFZdNI5ORX7TykUl+oGlm2x2qztbakOUz13I8vbd9WogyG5A cHGPGHuOOyhXhUWhN3tR39UGIKNCK+F4zHqwX6es= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:52 +1000 Message-Id: <20180907073155.26200-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 11/14] spapr: Correct reference count on spapr-cpu-core X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, Sam Bobroff , mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sam Bobroff spapr_init_cpus() currently creates spapr-cpu-core objects via object_new() and setting their realized property to true. This leaves their reference count at two, because object_new() adds an initial reference and the realization attaches them to a default parent object which also increments the reference count. This causes a problem if one of these cores is hot unplugged: no delete event is generated for it because it's reference count doesn't reach zero when it is detached from it's parent. Correct this by adding a call to object_unref() in spapr_init_cpus(). Signed-off-by: Sam Bobroff Signed-off-by: David Gibson --- hw/ppc/spapr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 505d4c84e5..4a9dd4d9bc 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2480,6 +2480,8 @@ static void spapr_init_cpus(sPAPRMachineState *spapr) object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID, &error_fatal); object_property_set_bool(core, true, "realized", &error_fatal); + + object_unref(core); } } } --=20 2.17.1