[libvirt] [PATCH v2 0/7] Check TSC frequency before starting QEMU

Jiri Denemark posted 7 patches 3 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1559564736.git.jdenemar@redhat.com
src/conf/cpu_conf.c          | 48 +++++++++++++++++++++
src/conf/cpu_conf.h          |  2 +
src/cpu/cpu_x86.c            | 81 ++++++++++++++++++++----------------
src/qemu/qemu_capabilities.c | 14 +++----
src/qemu/qemu_capspriv.h     |  5 +--
src/qemu/qemu_process.c      | 53 +++++++++++++++++++++++
src/util/virhostcpu.c        | 71 +++++++++++++++++++++++++++++++
src/util/virhostcpu.h        | 11 +++++
tests/Makefile.am            |  3 +-
tests/qemuargv2xmltest.c     |  3 +-
tests/qemucpumock.c          |  5 +--
11 files changed, 243 insertions(+), 53 deletions(-)

[libvirt] [PATCH v2 0/7] Check TSC frequency before starting QEMU

Posted by Jiri Denemark 3 weeks ago
Version 2:
- new patches (1 and 2) fixing qemuargv2xmltest, which was probing host
  CPU

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 (7):
  qemu: Make virQEMUCapsProbeHostCPUForEmulator more generic
  qemuargv2xmltest: Use mocked virQEMUCapsProbeHostCPU
  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_capabilities.c | 14 +++----
 src/qemu/qemu_capspriv.h     |  5 +--
 src/qemu/qemu_process.c      | 53 +++++++++++++++++++++++
 src/util/virhostcpu.c        | 71 +++++++++++++++++++++++++++++++
 src/util/virhostcpu.h        | 11 +++++
 tests/Makefile.am            |  3 +-
 tests/qemuargv2xmltest.c     |  3 +-
 tests/qemucpumock.c          |  5 +--
 11 files changed, 243 insertions(+), 53 deletions(-)

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list