summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Habkost2017-01-08 18:32:34 +0100
committerEduardo Habkost2017-01-24 00:26:27 +0100
commitd99569d9d8562c480e0befab601756b0b7b5d0e0 (patch)
tree4898552dc5253d4a564e998644e12f4bf01f7b2a
parentkvm: Simplify invtsc check (diff)
downloadqemu-d99569d9d8562c480e0befab601756b0b7b5d0e0.tar.gz
qemu-d99569d9d8562c480e0befab601756b0b7b5d0e0.tar.xz
qemu-d99569d9d8562c480e0befab601756b0b7b5d0e0.zip
kvm: Allow invtsc migration if tsc-khz is set explicitly
We can safely allow a VM to be migrated with invtsc enabled if tsc-khz is set explicitly, because: * QEMU already refuses to start if it can't set the TSC frequency to the configured value. * Management software is already required to keep device configuration (including CPU configuration) the same on migration source and destination. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20170108173234.25721-3-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
-rw-r--r--target/i386/kvm.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 9744552b8a..3b5282186c 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -963,15 +963,17 @@ int kvm_arch_init_vcpu(CPUState *cs)
has_msr_mcg_ext_ctl = has_msr_feature_control = true;
}
- if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
- invtsc_mig_blocker == NULL) {
- /* for migration */
- error_setg(&invtsc_mig_blocker,
- "State blocked by non-migratable CPU device"
- " (invtsc flag)");
- migrate_add_blocker(invtsc_mig_blocker);
- /* for savevm */
- vmstate_x86_cpu.unmigratable = 1;
+ if (!env->user_tsc_khz) {
+ if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
+ invtsc_mig_blocker == NULL) {
+ /* for migration */
+ error_setg(&invtsc_mig_blocker,
+ "State blocked by non-migratable CPU device"
+ " (invtsc flag)");
+ migrate_add_blocker(invtsc_mig_blocker);
+ /* for savevm */
+ vmstate_x86_cpu.unmigratable = 1;
+ }
}
cpuid_data.cpuid.padding = 0;