diff options
author | Bharata B Rao <bharata@linux.vnet.ibm.com> | 2015-09-24 13:52:48 +0530 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2015-10-23 10:38:10 +1100 |
commit | 7735fedaf490cf9213cd8d487272b69a4987c851 (patch) | |
tree | 9a42cc34de6858d8d904d9d21b7c362fec7ea9b5 /hw/ppc | |
parent | b817772a2521defba513b64b1d08238f24c50657 (diff) | |
download | qemu-7735fedaf490cf9213cd8d487272b69a4987c851.tar.gz qemu-7735fedaf490cf9213cd8d487272b69a4987c851.tar.bz2 qemu-7735fedaf490cf9213cd8d487272b69a4987c851.zip |
spapr: Abort when HTAB of requested size isn't allocated
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 <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 998a77bca2..f90f59283d 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; |