From nobody Mon Feb 9 09:27:44 2026 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.zoho.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 1496986604978782.0260868003671; Thu, 8 Jun 2017 22:36:44 -0700 (PDT) Received: from localhost ([::1]:52707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJCbB-0004Z1-FS for importer@patchew.org; Fri, 09 Jun 2017 01:36:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJCS1-00041k-6D for qemu-devel@nongnu.org; Fri, 09 Jun 2017 01:27:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJCRz-0006gv-9u for qemu-devel@nongnu.org; Fri, 09 Jun 2017 01:27:13 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:43889) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dJCRy-0006eb-Pu; Fri, 09 Jun 2017 01:27:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3wkW4d6Hrjz9sNm; Fri, 9 Jun 2017 15:26:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1496986017; bh=h5aH1hP7H6oHdDuCVIdIJ3WMIkx1E8klX6WwRMJ5T+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BaaDpMJU282enY7mKwYg5pyHRYnXcxNJ9wY9TifsAF2ehvWBhy18eyw2XIDU4GSCZ zmOdi7yit+rUMwG9RsYARAkoqAxFuOPNpCbGXac2tAu7ortLFUnLaZebN8nmj4gs6e ZEMek7TwNX0ofGUai6926DojyYNk1Y5NCcFNWaz8= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 9 Jun 2017 15:26:52 +1000 Message-Id: <20170609052652.23200-21-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170609052652.23200-1-david@gibson.dropbear.id.au> References: <20170609052652.23200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 20/20] Revert "spapr: fix memory hot-unplugging" 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: Laurent Vivier , qemu-devel@nongnu.org, sursingh@redhat.com, mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-ppc@nongnu.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: Laurent Vivier This reverts commit fe6824d12642b005c69123ecf8631f9b13553f8b. Conflicts hw/ppc/spapr_drc.c, because get_index() has been renamed spapr_get_index(). This didn't fix the problem. Once the hotplug has been started some memory is allocated and some structures are allocated. We don't free it when we ignore the unplug, and we can't because they can be in use by the kernel. Signed-off-by: Laurent Vivier Tested-by: Daniel Barboza Signed-off-by: David Gibson --- hw/ppc/spapr_drc.c | 20 +++----------------- include/hw/ppc/spapr_drc.h | 1 - 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 15ef67d..5cb75bb 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -128,17 +128,6 @@ static uint32_t set_allocation_state(sPAPRDRConnector = *drc, if (!drc->dev) { return RTAS_OUT_NO_SUCH_INDICATOR; } - if (drc->awaiting_release && drc->awaiting_allocation) { - /* kernel is acknowledging a previous hotplug event - * while we are already removing it. - * it's safe to ignore awaiting_allocation here since we know = the - * situation is predicated on the guest either already having = done - * so (boot-time hotplug), or never being able to acquire in t= he - * first place (hotplug followed by immediate unplug). - */ - drc->awaiting_allocation_skippable =3D true; - return RTAS_OUT_NO_SUCH_INDICATOR; - } } =20 if (spapr_drc_type(drc) !=3D SPAPR_DR_CONNECTOR_TYPE_PCI) { @@ -391,11 +380,9 @@ void spapr_drc_detach(sPAPRDRConnector *drc, DeviceSta= te *d, Error **errp) } =20 if (drc->awaiting_allocation) { - if (!drc->awaiting_allocation_skippable) { - drc->awaiting_release =3D true; - trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc)); - return; - } + drc->awaiting_release =3D true; + trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc)); + return; } =20 drc->dr_indicator =3D SPAPR_DR_INDICATOR_INACTIVE; @@ -418,7 +405,6 @@ void spapr_drc_detach(sPAPRDRConnector *drc, DeviceStat= e *d, Error **errp) } =20 drc->awaiting_release =3D false; - drc->awaiting_allocation_skippable =3D false; g_free(drc->fdt); drc->fdt =3D NULL; drc->fdt_start_offset =3D 0; diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h index c487123..bc9f988 100644 --- a/include/hw/ppc/spapr_drc.h +++ b/include/hw/ppc/spapr_drc.h @@ -201,7 +201,6 @@ typedef struct sPAPRDRConnector { bool awaiting_release; bool signalled; bool awaiting_allocation; - bool awaiting_allocation_skippable; =20 /* device pointer, via link property */ DeviceState *dev; --=20 2.9.4