From: Friedrich Oslage <friedrich@oslage.de> Update default to 0xFFFFFFFF ("never notify" in qemu) and make retries attribute optional. Signed-off-by: Friedrich Oslage <friedrich@oslage.de> --- NEWS.rst | 9 +++ docs/formatdomain.rst | 5 +- src/conf/domain_conf.c | 9 +-- ...-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 + 7 files changed, 157 insertions(+), 5 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/NEWS.rst b/NEWS.rst index f20d087c79..c7ef7e9eae 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -23,6 +23,15 @@ v11.9.0 (unreleased) enlightenments at domain startup into the live XML so that's obvious which enlightenments are enabled. + * Add support for Hyper-V ``spinlocks`` "never notify" mechanism + + The ``retries`` attribute - which defines after how many failed + acquisition attempts to notify the hypervisor - can now hold the + special value of 4294967295 which means to never notify the + hypervisor. + + If the ``retries`` attribute is omitted this value is used. + * **Improvements** * qemu: Improvements to USB controller model selection 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..96072f313b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17126,8 +17126,8 @@ 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) { @@ -28632,8 +28632,9 @@ virDomainFeaturesHyperVDefFormat(virBuffer *buf, case VIR_DOMAIN_HYPERV_SPINLOCKS: if (def->hyperv.features[j] == VIR_TRISTATE_SWITCH_ON) { - virBufferAsprintf(&hypervAttrBuf, - " retries='%u'", def->hyperv.spinlocks); + if (def->hyperv.spinlocks != UINT_MAX) + virBufferAsprintf(&hypervAttrBuf, + " retries='%u'", def->hyperv.spinlocks); } break; 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 @@ +<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 index 0000000000..62eace9582 --- /dev/null +++ b/tests/qemuxmlconfdata/hyperv-spinlocks-never-notify.xml @@ -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> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index e4d80faa99..021c923750 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -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"); -- 2.51.0