kvm: i386: allow TSC to differ by NTP correction bounds without TSC scaling
commit74aaddc6283ff789923127f3b95f781796fe3f39
authorMarcelo Tosatti <mtosatti@redhat.com>
Tue, 16 Jun 2020 16:58:05 +0000 (16 13:58 -0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 26 Jun 2020 13:39:40 +0000 (26 09:39 -0400)
tree4c9dc155e4038ff5caae52a30029eaf859329911
parent32a354dc6c07d766e70b51f42a62d8cd479e3f82
kvm: i386: allow TSC to differ by NTP correction bounds without TSC scaling

The Linux TSC calibration procedure is subject to small variations
(its common to see +-1 kHz difference between reboots on a given CPU, for example).

So migrating a guest between two hosts with identical processor can fail, in case
of a small variation in calibrated TSC between them.

Allow a conservative 250ppm error between host TSC and VM TSC frequencies,
rather than requiring an exact match. NTP daemon in the guest can
correct this difference.

Also change migration to accept this bound.

KVM_SET_TSC_KHZ depends on a kernel interface change. Without this change,
the behaviour remains the same: in case of a different frequency
between host and VM, KVM_SET_TSC_KHZ will fail and QEMU will exit.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Message-Id: <20200616165805.GA324612@fuller.cnet>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/kvm.c