[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 04/14] hw/ppc/spapr_hcall: set htab_shift after kvmppc_
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 04/14] hw/ppc/spapr_hcall: set htab_shift after kvmppc_resize_hpt_commit |
Date: |
Fri, 16 Feb 2018 21:06:07 +1100 |
From: Daniel Henrique Barboza <address@hidden>
Newer kernels have a htab resize capability when adding or remove
memory. At these situations, the guest kernel might reallocate its
htab to a more suitable size based on the resulting memory.
However, we're not setting the new value back into the machine state
when a KVM guest resizes its htab. At first this doesn't seem harmful,
but when migrating or saving the guest state (via virsh managedsave,
for instance) this mismatch between the htab size of QEMU and the
kernel makes the guest hangs when trying to load its state.
Inside h_resize_hpt_commit, the hypercall that commits the hash page
resize changes, let's set spapr->htab_shift to the new value if we're
sure that kvmppc_resize_hpt_commit were successful.
While we're here, add a "not RADIX" sanity check as it is already done
in the related hypercall h_resize_hpt_prepare.
Fixes: https://github.com/open-power-host-os/qemu/issues/28
Reported-by: Satheesh Rajendran <address@hidden>
Signed-off-by: Daniel Henrique Barboza <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_hcall.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 76422cfac1..1986560480 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -731,11 +731,21 @@ static target_ulong h_resize_hpt_commit(PowerPCCPU *cpu,
return H_AUTHORITY;
}
+ if (!spapr->htab_shift) {
+ /* Radix guest, no HPT */
+ return H_NOT_AVAILABLE;
+ }
+
trace_spapr_h_resize_hpt_commit(flags, shift);
rc = kvmppc_resize_hpt_commit(cpu, flags, shift);
if (rc != -ENOSYS) {
- return resize_hpt_convert_rc(rc);
+ rc = resize_hpt_convert_rc(rc);
+ if (rc == H_SUCCESS) {
+ /* Need to set the new htab_shift in the machine state */
+ spapr->htab_shift = shift;
+ }
+ return rc;
}
if (flags != 0) {
--
2.14.3
- [Qemu-ppc] [PULL 00/14] ppc-for-2.12 queue 20180216, David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 06/14] ppc/spapr-caps: Change migration macro to take full spapr-cap name, David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 04/14] hw/ppc/spapr_hcall: set htab_shift after kvmppc_resize_hpt_commit,
David Gibson <=
- [Qemu-ppc] [PULL 13/14] ppc/spapr-caps: Disallow setting workaround for spapr-cap-ibs, David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 08/14] spapr: move VCPU calculation to core machine code, David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 09/14] spapr: rename spapr_vcpu_id() to spapr_get_vcpu_id(), David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 02/14] ppc: move CUDAState and other CUDA-related definitions into separate cuda.h file, David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 12/14] target/ppc: convert to TranslatorOps, David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 10/14] spapr: consolidate the VCPU id numbering logic in a single place, David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 03/14] cuda: convert to trace-events, David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 07/14] spapr: use spapr->vsmt to compute VCPU ids, David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 05/14] hw/char: remove legacy interface escc_init(), David Gibson, 2018/02/16
- [Qemu-ppc] [PULL 11/14] target/ppc: convert to DisasContextBase, David Gibson, 2018/02/16