aboutsummaryrefslogtreecommitdiff
path: root/target-i386/kvm.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2010-10-21 13:35:03 -0200
committerMarcelo Tosatti <mtosatti@redhat.com>2010-10-21 13:37:40 -0200
commit384331a61a8ca42f32516ced20cb52470c5f6f57 (patch)
treef64c77db9ac9df9b4afc06ff1f2d75fa93bb2a48 /target-i386/kvm.c
parent75b10c43365e2a9cab5398f31b96a463b0d57eff (diff)
kvm: writeback SMP TSCs on migration only
commit 6389c45441269baa2873e6feafebd17105ddeaf6 Author: Jan Kiszka <jan.kiszka@siemens.com> Date: Mon Mar 1 18:17:26 2010 +0100 qemu-kvm: Cleanup/fix TSC and PV clock writeback Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'target-i386/kvm.c')
-rw-r--r--target-i386/kvm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 06474d6161..e2f7e2ef4a 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -817,7 +817,15 @@ static int kvm_put_msrs(CPUState *env, int level)
kvm_msr_entry_set(&msrs[n++], MSR_LSTAR, env->lstar);
#endif
if (level == KVM_PUT_FULL_STATE) {
- kvm_msr_entry_set(&msrs[n++], MSR_IA32_TSC, env->tsc);
+ /*
+ * KVM is yet unable to synchronize TSC values of multiple VCPUs on
+ * writeback. Until this is fixed, we only write the offset to SMP
+ * guests after migration, desynchronizing the VCPUs, but avoiding
+ * huge jump-backs that would occur without any writeback at all.
+ */
+ if (smp_cpus == 1 || env->tsc != 0) {
+ kvm_msr_entry_set(&msrs[n++], MSR_IA32_TSC, env->tsc);
+ }
kvm_msr_entry_set(&msrs[n++], MSR_KVM_SYSTEM_TIME,
env->system_time_msr);
kvm_msr_entry_set(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr);