From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTiVO-0007Lv-9C for qemu-devel@nongnu.org; Sun, 23 Aug 2015 23:33:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTiVL-0002AA-3P for qemu-devel@nongnu.org; Sun, 23 Aug 2015 23:33:06 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:53859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTiVK-000269-Hg for qemu-devel@nongnu.org; Sun, 23 Aug 2015 23:33:03 -0400 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Aug 2015 13:32:58 +1000 From: Bharata B Rao Date: Mon, 24 Aug 2015 09:01:51 +0530 Message-Id: <1440387111-23689-1-git-send-email-bharata@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH v0] spapr: Disable memory hotplug when HTAB size is insufficient List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, Bharata B Rao , Nathan Fontenot , david@gibson.dropbear.id.au, khandual@linux.vnet.ibm.com The hash table size allocated to guest depends on the maxmem size. If the host isn't able to allocate the required hash table size but instead allocates less than the optimal requested size, then it will not be possible to grow the RAM until maxmem via memory hotplug. Attempts to hotplug memory till maxmem could fail and this failure isn't being currently handled gracefully by the guest kernel thereby causing guest kernel oops. This should eventually get fixed when we move to completely in-kernel memory hotplug instead of the current method where userspace tool drmgr drives the hotplug. Until the in-kernel memory hotplug is available for PowerKVM, disable memory hotplug when requested hash table size isn't allocated. Signed-off-by: Bharata B Rao Cc: Nathan Fontenot --- Applies against spapr-next branch of David Gibson's tree. hw/ppc/spapr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c3268c5..4a07a7d 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -92,6 +92,9 @@ #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) +/* TODO: Move this to sPAPRMachineState ? */ +static bool spapr_memory_hotplug_disabled; + static XICSState *try_create_xics(const char *type, int nr_servers, int nr_irqs, Error **errp) { @@ -983,6 +986,14 @@ static void spapr_reset_htab(sPAPRMachineState *spapr) if (shift > 0) { /* Kernel handles htab, we don't need to allocate one */ + if (shift != spapr->htab_shift) { + /* + * Disable memory hotplug since we didn't get the requested + * hash table size. + */ + spapr_memory_hotplug_disabled = true; + } + spapr->htab_shift = shift; kvmppc_kern_htab = true; @@ -2149,6 +2160,11 @@ static void spapr_machine_device_plug(HotplugHandler *hotplug_dev, return; } + if (spapr_memory_hotplug_disabled) { + error_setg(errp, "Insufficient HTAB size to support memory hotplug"); + return; + } + spapr_memory_plug(hotplug_dev, dev, node, errp); } } -- 2.1.0