From: Marcelo Tosatti Date: Fri, 5 Sep 2014 13:52:47 +0000 (-0300) Subject: kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~548^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=317b0a6d8ba44e9bf8f9c3dbd776c4536843d82c;p=sdk%2Femulator%2Fqemu.git kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation Ensure proper env->tsc value for kvmclock_current_nsec calculation. Reported-by: Marcin Gibuła Analyzed-by: Marcin Gibuła Cc: qemu-stable@nongnu.org Signed-off-by: Marcelo Tosatti Signed-off-by: Paolo Bonzini --- diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c index 07b9c0e..9d65766 100644 --- a/hw/i386/kvm/clock.c +++ b/hw/i386/kvm/clock.c @@ -16,6 +16,7 @@ #include "qemu-common.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" +#include "sysemu/cpus.h" #include "hw/sysbus.h" #include "hw/kvm/clock.h" @@ -75,6 +76,9 @@ static void kvmclock_vm_state_change(void *opaque, int running, if (s->clock_valid) { return; } + + cpu_synchronize_all_states(); + cpu_clean_all_dirty(); ret = kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data); if (ret < 0) { fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(ret));