From patchwork Thu Jun 8 17:27:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 773394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wkC8F3Zxrz9s4s for ; Fri, 9 Jun 2017 03:29:01 +1000 (AEST) Received: from localhost ([::1]:50794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJ1Ex-0007eW-8X for incoming@patchwork.ozlabs.org; Thu, 08 Jun 2017 13:28:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJ1Dt-00075s-97 for qemu-devel@nongnu.org; Thu, 08 Jun 2017 13:27:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJ1Ds-00064i-1j for qemu-devel@nongnu.org; Thu, 08 Jun 2017 13:27:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34888) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dJ1Dr-00064O-PU; Thu, 08 Jun 2017 13:27:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B69AF79706; Thu, 8 Jun 2017 17:27:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B69AF79706 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lvivier@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B69AF79706 Received: from thinkpad.redhat.com (ovpn-117-35.ams2.redhat.com [10.36.117.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAF817F1C3; Thu, 8 Jun 2017 17:27:48 +0000 (UTC) From: Laurent Vivier To: David Gibson Date: Thu, 8 Jun 2017 19:27:43 +0200 Message-Id: <20170608172743.10132-3-lvivier@redhat.com> In-Reply-To: <20170608172743.10132-1-lvivier@redhat.com> References: <20170608172743.10132-1-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Jun 2017 17:27:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/2] 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 , Thomas Huth , qemu-devel@nongnu.org, Greg Kurz , Michael Roth , qemu-ppc@nongnu.org, Daniel Henrique Barboza Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 39e7f30..7605977 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -140,17 +140,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 the - * first place (hotplug followed by immediate unplug). - */ - drc->awaiting_allocation_skippable = true; - return RTAS_OUT_NO_SUCH_INDICATOR; - } } if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) { @@ -401,11 +390,9 @@ static void detach(sPAPRDRConnector *drc, DeviceState *d, Error **errp) } if (drc->awaiting_allocation) { - if (!drc->awaiting_allocation_skippable) { - drc->awaiting_release = true; - trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc)); - return; - } + drc->awaiting_release = true; + trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc)); + return; } drc->indicator_state = SPAPR_DR_INDICATOR_STATE_INACTIVE; @@ -428,7 +415,6 @@ static void detach(sPAPRDRConnector *drc, DeviceState *d, Error **errp) } drc->awaiting_release = false; - drc->awaiting_allocation_skippable = false; g_free(drc->fdt); drc->fdt = NULL; drc->fdt_start_offset = 0; diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h index c88e1be..84b58f0 100644 --- a/include/hw/ppc/spapr_drc.h +++ b/include/hw/ppc/spapr_drc.h @@ -200,7 +200,6 @@ typedef struct sPAPRDRConnector { bool awaiting_release; bool signalled; bool awaiting_allocation; - bool awaiting_allocation_skippable; /* device pointer, via link property */ DeviceState *dev;