From 66a47f80492026701509a89e33ce2050bc8d9a36 Mon Sep 17 00:00:00 2001 From: Friedrich Oslage Date: Wed, 22 Oct 2025 11:07:16 +0200 Subject: [PATCH] qemu: Update hyperv spinlock retries count default Update default to 0xFFFFFFFF ("never notify" in qemu) and make retries attribute optional. Signed-off-by: Friedrich Oslage Signed-off-by: Michal Privoznik Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 5 +- src/conf/domain_conf.c | 8 ++- ...-spinlocks-never-notify.x86_64-latest.args | 32 +++++++++++ ...v-spinlocks-never-notify.x86_64-latest.xml | 56 +++++++++++++++++++ .../hyperv-spinlocks-never-notify.xml | 50 +++++++++++++++++ tests/qemuxmlconftest.c | 1 + 6 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 39bdecf9a1..34dc9c3af7 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -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)` diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7c951fdc32..0223fc1d88 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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 index 0000000000..bb66adc6a4 --- /dev/null +++ b/tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.args @@ -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 index 0000000000..30efa09370 --- /dev/null +++ b/tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.x86_64-latest.xml @@ -0,0 +1,56 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 6 + + hvm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qemu64 + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + +
+ + + + +