[libvirt] [PATCH] Only determine GuestCPU features if required

Guido Günther agx at sigxcpu.org
Mon Nov 11 09:23:46 UTC 2013


There's no need to probe CPU features if we don't need them later.

Debian Wheezy's QEMU 1.1.2 lacks the feature-word option so this
unbreaks starting domains that got broken by
d94b7817719b064849818b9ba6c37e403b7c003c like

    error: internal error: unable to execute QEMU command 'qom-get': Property '.feature-words' not found
---
This might not be ideal since we might to want to use
qemuMonitorGetGuestCPU somewhere else later so I'm happy
to improve on this.
Cheers,
 -- Guido

 src/qemu/qemu_process.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index fcceedd..be09ea0 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3477,14 +3477,14 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm)
     switch (arch) {
     case VIR_ARCH_I686:
     case VIR_ARCH_X86_64:
-        qemuDomainObjEnterMonitor(driver, vm);
-        guestcpu = qemuMonitorGetGuestCPU(priv->mon, arch);
-        qemuDomainObjExitMonitor(driver, vm);
+        if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_DOMAIN_FEATURE_STATE_ON) {
+            qemuDomainObjEnterMonitor(driver, vm);
+            guestcpu = qemuMonitorGetGuestCPU(priv->mon, arch);
+            qemuDomainObjExitMonitor(driver, vm);
 
-        if (!(guestcpu))
-            goto cleanup;
+            if (!(guestcpu))
+                goto cleanup;
 
-        if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_DOMAIN_FEATURE_STATE_ON) {
             if (!cpuHasFeature(guestcpu, VIR_CPU_x86_KVM_PV_UNHALT)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("host doesn't support paravirtual spinlocks"));
-- 
1.8.4.2




More information about the libvir-list mailing list