|
|
9ae3a8 |
From da4fe791cecafbec05395041c52cb545308b1b61 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Marcelo Tosatti <mtosatti@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 26 Jun 2014 15:06:15 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 13/13] kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Marcelo Tosatti <mtosatti@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20140626150716.639538444@amt.cnet>
|
|
|
9ae3a8 |
Patchwork-id: 59386
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/2] kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation
|
|
|
9ae3a8 |
Bugzilla: 1098602
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Andrew Jones <drjones@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
commit 9b1786829aefb83f37a8f3135e3ea91c56001b56 upstream
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Ensure proper env->tsc value for kvmclock_current_nsec calculation.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reported-by: Marcin GibuĊa <m.gibula@beyond.pl>
|
|
|
9ae3a8 |
Cc: qemu-stable@nongnu.org
|
|
|
9ae3a8 |
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
BZ: 1098602
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/i386/kvm/clock.c | 4 ++++
|
|
|
9ae3a8 |
1 file changed, 4 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/i386/kvm/clock.c | 4 ++++
|
|
|
9ae3a8 |
1 files changed, 4 insertions(+), 0 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
|
|
|
9ae3a8 |
index 1f2a26e..d52c2ea 100644
|
|
|
9ae3a8 |
--- a/hw/i386/kvm/clock.c
|
|
|
9ae3a8 |
+++ b/hw/i386/kvm/clock.c
|
|
|
9ae3a8 |
@@ -17,6 +17,7 @@
|
|
|
9ae3a8 |
#include "qemu/host-utils.h"
|
|
|
9ae3a8 |
#include "sysemu/sysemu.h"
|
|
|
9ae3a8 |
#include "sysemu/kvm.h"
|
|
|
9ae3a8 |
+#include "sysemu/cpus.h"
|
|
|
9ae3a8 |
#include "hw/sysbus.h"
|
|
|
9ae3a8 |
#include "hw/kvm/clock.h"
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -60,6 +61,7 @@ static uint64_t kvmclock_current_nsec(KVMClockState *s)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time));
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ assert(time.tsc_timestamp <= migration_tsc);
|
|
|
9ae3a8 |
delta = migration_tsc - time.tsc_timestamp;
|
|
|
9ae3a8 |
if (time.tsc_shift < 0) {
|
|
|
9ae3a8 |
delta >>= -time.tsc_shift;
|
|
|
9ae3a8 |
@@ -118,6 +120,8 @@ static void kvmclock_vm_state_change(void *opaque, int running,
|
|
|
9ae3a8 |
if (s->clock_valid) {
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ cpu_synchronize_all_states();
|
|
|
9ae3a8 |
ret = kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(ret));
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|