[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 05/42] migration: Do not re-read the clock on pre_save
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 05/42] migration: Do not re-read the clock on pre_save in case of paused guest |
Date: |
Wed, 21 Aug 2019 17:25:05 +1000 |
From: "Maxiwell S. Garcia" <address@hidden>
Re-read the timebase before migrate was ported from x86 commit:
6053a86fe7bd: kvmclock: reduce kvmclock difference on migration
The clock move makes the guest knows about the paused time between
the stop and migrate commands. This is an issue in an already-paused
VM because some side effects, like process stalls, could happen
after migration.
So, this patch checks the runstate of guest in the pre_save handler and
do not re-reads the timebase in case of paused state (cold migration).
Signed-off-by: Maxiwell S. Garcia <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/ppc.c | 13 +++++++++----
target/ppc/cpu-qom.h | 1 +
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index 7963feeab4..52a18eb7d7 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -1011,6 +1011,8 @@ static void timebase_save(PPCTimebase *tb)
* there is no need to update it from KVM here
*/
tb->guest_timebase = ticks + first_ppc_cpu->env.tb_env->tb_offset;
+
+ tb->runstate_paused = runstate_check(RUN_STATE_PAUSED);
}
static void timebase_load(PPCTimebase *tb)
@@ -1054,9 +1056,9 @@ void cpu_ppc_clock_vm_state_change(void *opaque, int
running,
}
/*
- * When migrating, read the clock just before migration,
- * so that the guest clock counts during the events
- * between:
+ * When migrating a running guest, read the clock just
+ * before migration, so that the guest clock counts
+ * during the events between:
*
* * vm_stop()
* *
@@ -1071,7 +1073,10 @@ static int timebase_pre_save(void *opaque)
{
PPCTimebase *tb = opaque;
- timebase_save(tb);
+ /* guest_timebase won't be overridden in case of paused guest */
+ if (!tb->runstate_paused) {
+ timebase_save(tb);
+ }
return 0;
}
diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
index a2f202f021..5769fb78a9 100644
--- a/target/ppc/cpu-qom.h
+++ b/target/ppc/cpu-qom.h
@@ -201,6 +201,7 @@ typedef struct PowerPCCPUClass {
typedef struct PPCTimebase {
uint64_t guest_timebase;
int64_t time_of_the_day_ns;
+ bool runstate_paused;
} PPCTimebase;
extern const VMStateDescription vmstate_ppc_timebase;
--
2.21.0
- [Qemu-ppc] [PULL 00/42] ppc-for-4.2 queue 20190821, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 04/42] spapr_pci: Allow 2MiB and 16MiB IOMMU pagesizes by default, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 02/42] spapr_iommu: Fix xlate trace to print translated address, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 05/42] migration: Do not re-read the clock on pre_save in case of paused guest,
David Gibson <=
- [Qemu-ppc] [PULL 01/42] spapr: quantify error messages regarding capability settings, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 11/42] target/ppc: Optimize emulation of vclzw instruction, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 10/42] target/ppc: Optimize emulation of vclzd instruction, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 19/42] docs/specs: initial spec summary for Ultravisor-related hcalls, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 03/42] hw: add compat machines for 4.2, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 08/42] target/ppc: move opcode decode tables to PowerPCCPU, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 07/42] target/ppc: Optimize emulation of vsl and vsr instructions, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 06/42] target/ppc: Optimize emulation of lvsl and lvsr instructions, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 12/42] ppc: fix memory leak in spapr_caps_add_properties, David Gibson, 2019/08/21
- [Qemu-ppc] [PULL 13/42] ppc: fix memory leak in spapr_dt_drc(), David Gibson, 2019/08/21