Commit d99569d9 authored by Eduardo Habkost's avatar Eduardo Habkost
Browse files

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: default avatarEduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170108173234.25721-3-ehabkost@redhat.com>
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
parent d74460ec
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -963,6 +963,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
        has_msr_mcg_ext_ctl = has_msr_feature_control = true;
    }

    if (!env->user_tsc_khz) {
        if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
            invtsc_mig_blocker == NULL) {
            /* for migration */
@@ -973,6 +974,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
            /* for savevm */
            vmstate_x86_cpu.unmigratable = 1;
        }
    }

    cpuid_data.cpuid.padding = 0;
    r = kvm_vcpu_ioctl(cs, KVM_SET_CPUID2, &cpuid_data);