aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/kvm/clock.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2014-09-05 10:52:47 -0300
committerPaolo Bonzini <pbonzini@redhat.com>2014-09-16 11:11:24 +0200
commit317b0a6d8ba44e9bf8f9c3dbd776c4536843d82c (patch)
tree72b72b3800ab1bedb1f2113ab2ba46a0dd4995c8 /hw/i386/kvm/clock.c
parentde9d61e83d43be9069e6646fa9d57a3f47779d28 (diff)
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 <m.gibula@beyond.pl> Analyzed-by: Marcin Gibuła <m.gibula@beyond.pl> Cc: qemu-stable@nongnu.org Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386/kvm/clock.c')
-rw-r--r--hw/i386/kvm/clock.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 07b9c0e581..9d657662b2 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));