]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Update hyperv spinlock retries count default
authorFriedrich Oslage <friedrich@oslage.de>
Wed, 22 Oct 2025 09:07:16 +0000 (11:07 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 22 Oct 2025 13:17:44 +0000 (15:17 +0200)
Update default to 0xFFFFFFFF ("never notify" in qemu) and make retries
attribute optional.

Signed-off-by: Friedrich Oslage <friedrich@oslage.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/formatdomain.rst
src/conf/domain_conf.c
tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.args [new file with mode: 0644]
tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.xml [new file with mode: 0644]
tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.xml [new file with mode: 0644]
tests/qemuxmlconftest.c

index 39bdecf9a169ec4764fe39c74a1018ea8c2750e3..34dc9c3af729784b0699dddd8d56f12ca4c1b21b 100644 (file)
@@ -2155,7 +2155,10 @@ are:
    =============== ====================================================================== ============================================ ========================================================================
    relaxed         Relax constraints on timers                                            on, off                                      :since:`1.0.0 (QEMU 2.0), 11.3.0 (Xen, always on)`
    vapic           Enable virtual APIC                                                    on, off                                      :since:`1.1.0 (QEMU 2.0), 11.3.0 (Xen)`
-   spinlocks       Enable spinlock support                                                on, off; retries - at least 4095             :since:`1.1.0 (QEMU 2.0)`
+   spinlocks       Enable spinlock support - retries attribute defines after how many     on, off;                                     :since:`1.1.0 (QEMU 2.0), never-notify mode 11.9.0 (QEMU 2.0)`
+                   failed acquisition attempts to notify the hypervisor                   retries - between 4095 and 4294967295, the
+                                                                                          special value 4294967295 means to never
+                                                                                          notify the hypervisor (default if omitted)
    vpindex         Virtual processor index                                                on, off                                      :since:`1.3.3 (QEMU 2.5), 11.3.0 (Xen, always on)`
    runtime         Processor time spent on running guest code and on behalf of guest code on, off                                      :since:`1.3.3 (QEMU 2.5)`
    synic           Enable Synthetic Interrupt Controller (SynIC)                          on, off                                      :since:`1.3.3 (QEMU 2.6), 11.3.0 (Xen)`
index 7c951fdc327204e8f6203c8c9cd0414099dd2441..0223fc1d884edbc3618fb400374e1d88fe2d1c2b 100644 (file)
@@ -17126,9 +17126,10 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def,
             if (value != VIR_TRISTATE_SWITCH_ON)
                 break;
 
-            if (virXMLPropUInt(node, "retries", 0, VIR_XML_PROP_REQUIRED,
-                               &def->hyperv.spinlocks) < 0)
+            if (virXMLPropUIntDefault(node, "retries", 0, VIR_XML_PROP_NONE,
+                                      &def->hyperv.spinlocks, UINT_MAX) < 0) {
                 return -1;
+            }
 
             if (def->hyperv.spinlocks < 0xFFF) {
                 virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -28631,7 +28632,8 @@ virDomainFeaturesHyperVDefFormat(virBuffer *buf,
             break;
 
         case VIR_DOMAIN_HYPERV_SPINLOCKS:
-            if (def->hyperv.features[j] == VIR_TRISTATE_SWITCH_ON) {
+            if (def->hyperv.features[j] == VIR_TRISTATE_SWITCH_ON &&
+                def->hyperv.spinlocks != UINT_MAX) {
                 virBufferAsprintf(&hypervAttrBuf,
                                   " retries='%u'", def->hyperv.spinlocks);
             }
diff --git a/tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.args b/tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.args
new file mode 100644 (file)
index 0000000..bb66adc
--- /dev/null
@@ -0,0 +1,32 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \
+-accel tcg \
+-cpu 'qemu64,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0xffffffff,hv-vpindex=on,hv-runtime=on,hv-synic=on,hv-stimer=on,hv-reset=on,hv-vendor-id=KVM Hv,hv-frequencies=on,hv-reenlightenment=on,hv-tlbflush=on,hv-tlbflush-direct=on,hv-tlbflush-ext=on,hv-ipi=on,hv-evmcs=on,hv-avic=on,hv-emsr-bitmap=on,hv-xmm-input=on' \
+-m size=219136k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 6,sockets=6,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.xml b/tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.xml
new file mode 100644 (file)
index 0000000..30efa09
--- /dev/null
@@ -0,0 +1,56 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <hyperv mode='custom'>
+      <relaxed state='on'/>
+      <vapic state='on'/>
+      <spinlocks state='on'/>
+      <vpindex state='on'/>
+      <runtime state='on'/>
+      <synic state='on'/>
+      <stimer state='on'/>
+      <reset state='on'/>
+      <vendor_id state='on' value='KVM Hv'/>
+      <frequencies state='on'/>
+      <reenlightenment state='on'/>
+      <tlbflush state='on'>
+        <direct state='on'/>
+        <extended state='on'/>
+      </tlbflush>
+      <ipi state='on'/>
+      <evmcs state='on'/>
+      <avic state='on'/>
+      <emsr_bitmap state='on'/>
+      <xmm_input state='on'/>
+    </hyperv>
+  </features>
+  <cpu mode='custom' match='exact' check='none'>
+    <model fallback='forbid'>qemu64</model>
+  </cpu>
+  <clock offset='utc'>
+    <timer name='hypervclock' present='yes'/>
+  </clock>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0' model='piix3-uhci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <audio id='1' type='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.xml b/tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.xml
new file mode 100644 (file)
index 0000000..62eace9
--- /dev/null
@@ -0,0 +1,50 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <hyperv>
+      <relaxed state='on'/>
+      <vapic state='on'/>
+      <spinlocks state='on' retries='4294967295'/>
+      <vpindex state='on'/>
+      <runtime state='on'/>
+      <synic state='on'/>
+      <stimer state='on'/>
+      <reset state='on'/>
+      <vendor_id state='on' value='KVM Hv'/>
+      <frequencies state='on'/>
+      <reenlightenment state='on'/>
+      <tlbflush state='on'>
+        <direct state='on'/>
+        <extended state='on'/>
+      </tlbflush>
+      <ipi state='on'/>
+      <evmcs state='on'/>
+      <avic state='on'/>
+      <emsr_bitmap state='on'/>
+      <xmm_input state='on'/>
+    </hyperv>
+  </features>
+  <clock offset='utc'>
+    <timer name='hypervclock' present='yes'/>
+  </clock>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
index 1f39779d7bf8bd298a9b610af903b818ab83ba26..aa6e1ad1675740aae0cc9ba804683b127377855f 100644 (file)
@@ -1655,6 +1655,7 @@ mymain(void)
     DO_TEST_CAPS_LATEST("hyperv-off");
     DO_TEST_CAPS_LATEST("hyperv-panic");
     DO_TEST_CAPS_LATEST("hyperv-passthrough");
+    DO_TEST_CAPS_LATEST("hyperv-spinlocks-never-notify");
     DO_TEST_CAPS_LATEST("hyperv-stimer-direct");
     DO_TEST_CAPS_LATEST("hyperv-host-model");