From patchwork Fri Oct 23 09:43:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 534866 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 C1D51141332 for ; Fri, 23 Oct 2015 20:46:13 +1100 (AEDT) Received: from localhost ([::1]:37241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpYvL-00023E-Cp for incoming@patchwork.ozlabs.org; Fri, 23 Oct 2015 05:46:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpYsU-0005eP-Do for qemu-devel@nongnu.org; Fri, 23 Oct 2015 05:43:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpYsP-0008Po-Kg for qemu-devel@nongnu.org; Fri, 23 Oct 2015 05:43:14 -0400 Received: from ozlabs.org ([103.22.144.67]:49020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpYsP-0008OS-7b; Fri, 23 Oct 2015 05:43:09 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 0D4A1141333; Fri, 23 Oct 2015 20:43:05 +1100 (AEDT) From: David Gibson To: peter.maydell@linaro.org Date: Fri, 23 Oct 2015 20:43:14 +1100 Message-Id: <1445593413-22057-4-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1445593413-22057-1-git-send-email-david@gibson.dropbear.id.au> References: <1445593413-22057-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, aik@ozlabs.ru, agraf@suse.de, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Subject: [Qemu-devel] [PULL 02/21] spapr: Abort when HTAB of requested size isn't allocated X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bharata B Rao Terminate the guest when HTAB of requested size isn't allocated by the host. When memory hotplug is attempted on a guest that has booted with less than requested HTAB size, the guest kernel will not be able to gracefully fail the hotplug request. This patch will ensure that we never end up in a situation where memory hotplug fails due to less than requested HTAB size. Signed-off-by: Bharata B Rao Signed-off-by: David Gibson --- hw/ppc/spapr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 998a77b..f90f592 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -992,6 +992,10 @@ static void spapr_alloc_htab(sPAPRMachineState *spapr) if (shift > 0) { /* Kernel handles htab, we don't need to allocate one */ + if (shift != spapr->htab_shift) { + error_setg(&error_abort, "Failed to allocate HTAB of requested size, try with smaller maxmem"); + } + spapr->htab_shift = shift; kvmppc_kern_htab = true; } else { @@ -1020,6 +1024,10 @@ static void spapr_reset_htab(sPAPRMachineState *spapr) shift = kvmppc_reset_htab(spapr->htab_shift); if (shift > 0) { + if (shift != spapr->htab_shift) { + error_setg(&error_abort, "Requested HTAB allocation failed during reset"); + } + /* Tell readers to update their file descriptor */ if (spapr->htab_fd >= 0) { spapr->htab_fd_stale = true;