When migrating a domain with invtsc CPU feature enabled, the TSC
frequency of the destination host must match the frequency used when the
domain was started on the source host or the destination host has to
support TSC scaling.
If the frequencies do not match and the destination host does not
support TSC scaling, QEMU will fail to set the right TSC frequency when
starting vCPUs on the destination and thus migration will fail. However,
this is quite late since both host might have spent significant time
transferring memory and perhaps even storage data.
By adding the check to libvirt we can let migration fail before any data
starts to be sent over. If for some reason libvirt is unable to detect
the host's TSC frequency or scaling support, we'll just let QEMU try and
the migration will either succeed or fail later.
Luckily, we mandate TSC frequency to be explicitly set in the domain XML
to even allow migration of domains with invtsc. We can just check
whether the requested frequency is compatible with the current host
before starting QEMU.
And to let libvirt client decide whether it should even start the
migration to a specific host, this series adds host's TSC frequency and
scaling support to the host CPU capabilities XML.
https://bugzilla.redhat.com/show_bug.cgi?id=1641702
Jiri Denemark (5):
util: Add virHostCPUGetTscInfo
conf: Report TSC frequency in host CPU capabilities
cpu_x86: Fix placement of *CheckFeature functions
cpu_x86: Probe TSC frequency and scaling support
qemu: Check TSC frequency before starting QEMU
src/conf/cpu_conf.c | 48 ++++++++++++++++++++++++
src/conf/cpu_conf.h | 2 +
src/cpu/cpu_x86.c | 81 ++++++++++++++++++++++-------------------
src/qemu/qemu_process.c | 53 +++++++++++++++++++++++++++
src/util/virhostcpu.c | 71 ++++++++++++++++++++++++++++++++++++
src/util/virhostcpu.h | 11 ++++++
6 files changed, 229 insertions(+), 37 deletions(-)
--
2.21.0