[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 13/13] migration: Do not re-read the clock on pre_
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL v2 13/13] migration: Do not re-read the clock on pre_save in case of paused guest |
Date: |
Tue, 3 Sep 2019 18:02:01 -0300 |
From: "Maxiwell S. Garcia" <address@hidden>
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 clock in case of paused state (cold migration).
Signed-off-by: Maxiwell S. Garcia <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Marcelo Tosatti <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/i386/kvm/clock.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 80c133a724..2c59b6894b 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -41,6 +41,9 @@ typedef struct KVMClockState {
uint64_t clock;
bool clock_valid;
+ /* whether the 'clock' value was obtained in the 'paused' state */
+ bool runstate_paused;
+
/* whether machine type supports reliable KVM_GET_CLOCK */
bool mach_use_reliable_get_clock;
@@ -202,6 +205,8 @@ static void kvmclock_vm_state_change(void *opaque, int
running,
return;
}
+ s->runstate_paused = runstate_check(RUN_STATE_PAUSED);
+
kvm_synchronize_all_tsc();
kvm_update_clock(s);
@@ -260,9 +265,9 @@ static int kvmclock_pre_load(void *opaque)
}
/*
- * 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()
* *
@@ -277,7 +282,9 @@ static int kvmclock_pre_save(void *opaque)
{
KVMClockState *s = opaque;
- kvm_update_clock(s);
+ if (!s->runstate_paused) {
+ kvm_update_clock(s);
+ }
return 0;
}
--
2.21.0
- [Qemu-devel] [PULL v2 03/13] numa: move numa global variable nb_numa_nodes into MachineState, (continued)
- [Qemu-devel] [PULL v2 03/13] numa: move numa global variable nb_numa_nodes into MachineState, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 05/13] numa: move numa global variable numa_info into MachineState, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 06/13] pc: Fix error message on die-id validation, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 08/13] pc: Don't make die-id mandatory unless necessary, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 02/13] hw/arm: simplify arm_load_dtb, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 09/13] qapi: report the default CPU type for each machine, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 07/13] pc: Improve error message when die-id is omitted, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 10/13] hostmem-file: fix pmem file size check, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 11/13] i386/vmmouse: Properly reset state, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 12/13] x86: do not advertise die-id in query-hotpluggbale-cpus if '-smp dies' is not set, Eduardo Habkost, 2019/09/03
- [Qemu-devel] [PULL v2 13/13] migration: Do not re-read the clock on pre_save in case of paused guest,
Eduardo Habkost <=
- Re: [Qemu-devel] [PULL v2 00/13] Machine + x86 queue, 2019-09-03, Peter Maydell, 2019/09/04