From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4VT-0001iW-Ig for qemu-devel@nongnu.org; Thu, 24 Sep 2015 07:16:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf4VQ-0004f9-Dn for qemu-devel@nongnu.org; Thu, 24 Sep 2015 07:16:07 -0400 Received: from e28smtp07.in.ibm.com ([122.248.162.7]:41255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4VP-0004d0-Mi for qemu-devel@nongnu.org; Thu, 24 Sep 2015 07:16:04 -0400 Received: from /spool/local by e28smtp07.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 Sep 2015 16:46:00 +0530 From: Bharata B Rao Date: Thu, 24 Sep 2015 13:52:48 +0530 Message-Id: <1443082968-20440-3-git-send-email-bharata@linux.vnet.ibm.com> In-Reply-To: <1443082968-20440-1-git-send-email-bharata@linux.vnet.ibm.com> References: <1443082968-20440-1-git-send-email-bharata@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH v1 2/2] spapr: Abort when HTAB of requested size isn't allocated List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: nfont@linux.vnet.ibm.com, Bharata B Rao , qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com, david@gibson.dropbear.id.au 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 --- hw/ppc/spapr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index f6a5c29..3c60df2 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; -- 2.1.0