qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH v0] spapr: Disable memory hotplug when HTAB size is insufficient
@ 2015-08-24  3:31 Bharata B Rao
  2015-08-24  4:34 ` Anshuman Khandual
  2015-09-02  3:28 ` Bharata B Rao
  0 siblings, 2 replies; 9+ messages in thread
From: Bharata B Rao @ 2015-08-24  3:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: mdroth, qemu-ppc, Bharata B Rao, Nathan Fontenot, david, khandual

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 <bharata@linux.vnet.ibm.com>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-09  9:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24  3:31 [Qemu-devel] [RFC PATCH v0] spapr: Disable memory hotplug when HTAB size is insufficient Bharata B Rao
2015-08-24  4:34 ` Anshuman Khandual
2015-09-02  3:28 ` Bharata B Rao
2015-09-03  2:34   ` David Gibson
2015-09-03 18:50   ` Nathan Fontenot
2015-09-04 15:33     ` Michael Roth
2015-09-04 15:49       ` Nathan Fontenot
2015-09-04 16:12         ` Michael Roth
2015-09-09  9:06           ` Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).