From: Chris Riches <chris.riches@nutanix.com> Ever since commit 3fc4412c6f (qemu: support kvm-poll-control performance hint) introduced support for kvm-poll-control, libvirt has only emitted the arg when it is explicitly enabled. However, leaving the arg missing from the output is not equivalent to disabling it, since QEMU may default it to `on` in certain paths (for example, with `-cpu host`). Therefore, if the XML specifies state='off', we should explicitly set that to ensure it is disabled in qemu. Signed-off-by: Chris Riches <chris.riches@nutanix.com> --- src/qemu/qemu_command.c | 7 +++++-- tests/qemuxmlconfdata/kvm-features-off.x86_64-latest.args | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e726dc661c..dbc4b5ac94 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6745,8 +6745,11 @@ qemuBuildCpuCommandLine(virCommand *cmd, break; case VIR_DOMAIN_KVM_POLLCONTROL: - if (def->kvm_features->features[i] == VIR_TRISTATE_SWITCH_ON) - virBufferAddLit(&buf, ",kvm-poll-control=on"); + if (def->kvm_features->features[i]) { + virBufferAsprintf(&buf, ",kvm-poll-control=%s", + def->kvm_features->features[i] == + VIR_TRISTATE_SWITCH_ON ? "on" : "off"); + } break; case VIR_DOMAIN_KVM_PVIPI: diff --git a/tests/qemuxmlconfdata/kvm-features-off.x86_64-latest.args b/tests/qemuxmlconfdata/kvm-features-off.x86_64-latest.args index 70b1fb83e1..8c1e238e2e 100644 --- a/tests/qemuxmlconfdata/kvm-features-off.x86_64-latest.args +++ b/tests/qemuxmlconfdata/kvm-features-off.x86_64-latest.args @@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -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 kvm \ --cpu host,migratable=off,kvm-pv-ipi=off \ +-cpu host,migratable=off,kvm-poll-control=off,kvm-pv-ipi=off \ -m size=219136k \ -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ -overcommit mem-lock=off \ -- 2.43.0