From: Chris Riches <chris.riches@nutanix.com> Ever since commit b2757b697e (qemu: support kvm-pv-ipi off) introduced support for kvm-pv-ipi, libvirt has only emitted the arg when it is explicitly disabled. However, leaving the arg missing from the output is not equivalent to enabling it, since QEMU may default it to `off` in certain paths (for example, without `-cpu host`). Therefore, if the XML specifies state='on', we should explicitly set that to ensure it is enabled in qemu. Signed-off-by: Chris Riches <chris.riches@nutanix.com> --- src/qemu/qemu_command.c | 7 +++++-- tests/qemuxmlconfdata/kvm-features.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 dbc4b5ac94..d1e4e39c45 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6753,8 +6753,11 @@ qemuBuildCpuCommandLine(virCommand *cmd, break; case VIR_DOMAIN_KVM_PVIPI: - if (def->kvm_features->features[i] == VIR_TRISTATE_SWITCH_OFF) - virBufferAddLit(&buf, ",kvm-pv-ipi=off"); + if (def->kvm_features->features[i]) { + virBufferAsprintf(&buf, ",kvm-pv-ipi=%s", + def->kvm_features->features[i] == + VIR_TRISTATE_SWITCH_ON ? "on" : "off"); + } break; case VIR_DOMAIN_KVM_DIRTY_RING: diff --git a/tests/qemuxmlconfdata/kvm-features.x86_64-latest.args b/tests/qemuxmlconfdata/kvm-features.x86_64-latest.args index 8221fdb16f..90d3ffba55 100644 --- a/tests/qemuxmlconfdata/kvm-features.x86_64-latest.args +++ b/tests/qemuxmlconfdata/kvm-features.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,dirty-ring-size=4096 \ --cpu host,migratable=off,kvm=off,kvm-hint-dedicated=on,kvm-poll-control=on \ +-cpu host,migratable=off,kvm=off,kvm-hint-dedicated=on,kvm-poll-control=on,kvm-pv-ipi=on \ -m size=219136k \ -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ -overcommit mem-lock=off \ -- 2.43.0