]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: refresh vcpu halted state only via query-cpus-fast
authorViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Wed, 4 Apr 2018 14:45:07 +0000 (16:45 +0200)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 17 Apr 2018 16:45:26 +0000 (12:45 -0400)
In order to not affect running VMs, refreshing the halted state
is only performed if QEMU supports the query-cpus-fast QAPI.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_domain.c

index be6fc7ea96e21ba1f93fe595a59f45e3692de0ee..e954342a96f63e2dd7909f6822df580ef556e901 100644 (file)
@@ -9161,8 +9161,13 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
         return 0;
 
     /* The halted state is interresting only on s390(x). On other platforms
-     * the data would be stale at the time when it would be used. */
-    if (!ARCH_IS_S390(vm->def->os.arch))
+     * the data would be stale at the time when it would be used.
+     * Calling qemuMonitorGetCpuHalted() can adversely affect the running
+     * VM's performance unless QEMU supports query-cpus-fast.
+     */
+    if (!ARCH_IS_S390(vm->def->os.arch) ||
+        !virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
+                        QEMU_CAPS_QUERY_CPUS_FAST))
         return 0;
 
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)