[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V1 10/32] kvmclock: restore paused KVM clock
From: |
Steve Sistare |
Subject: |
[PATCH V1 10/32] kvmclock: restore paused KVM clock |
Date: |
Thu, 30 Jul 2020 08:14:14 -0700 |
If the VM is paused when the KVM clock is serialized to a file, record
that the clock is valid, so the value will be reused rather than
overwritten after cprload with a new call to KVM_GET_CLOCK here:
kvmclock_vm_state_change()
if (running)
...
else
if (s->clock_valid)
return; <-- instead, return here
kvm_update_clock()
kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data) <-- overwritten
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
hw/i386/kvm/clock.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 6428335..161991a 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -285,18 +285,22 @@ static int kvmclock_pre_save(void *opaque)
if (!s->runstate_paused) {
kvm_update_clock(s);
}
+ if (!runstate_is_running()) {
+ s->clock_valid = true;
+ }
return 0;
}
static const VMStateDescription kvmclock_vmsd = {
.name = "kvmclock",
- .version_id = 1,
+ .version_id = 2,
.minimum_version_id = 1,
.pre_load = kvmclock_pre_load,
.pre_save = kvmclock_pre_save,
.fields = (VMStateField[]) {
VMSTATE_UINT64(clock, KVMClockState),
+ VMSTATE_BOOL_V(clock_valid, KVMClockState, 2),
VMSTATE_END_OF_LIST()
},
.subsections = (const VMStateDescription * []) {
--
1.8.3.1
- [PATCH V1 00/32] Live Update, Steve Sistare, 2020/07/30
- [PATCH V1 07/32] savevm: QMP command for cprinfo, Steve Sistare, 2020/07/30
- [PATCH V1 04/32] savevm: HMP Command for cprsave, Steve Sistare, 2020/07/30
- [PATCH V1 03/32] savevm: QMP command for cprsave, Steve Sistare, 2020/07/30
- [PATCH V1 10/32] kvmclock: restore paused KVM clock,
Steve Sistare <=
- [PATCH V1 01/32] savevm: add vmstate handler iterators, Steve Sistare, 2020/07/30
- [PATCH V1 08/32] savevm: HMP command for cprinfo, Steve Sistare, 2020/07/30
- [PATCH V1 06/32] savevm: HMP Command for cprload, Steve Sistare, 2020/07/30
- [PATCH V1 11/32] cpu: disable ticks when suspended, Steve Sistare, 2020/07/30
- [PATCH V1 12/32] vl: pause option, Steve Sistare, 2020/07/30
- Re: [PATCH V1 12/32] vl: pause option, Alex Bennée, 2020/07/30