From 359e9f5cf4526eff630d803f68df9733abaef419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Date: Tue, 23 Nov 2021 09:36:59 -0500 Subject: [PATCH] qemu: Generate command line for dirty-ring-size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On QEMU command line it's represented by the dirty-ring-size attribute of KVM accelerator. Signed-off-by: Hyman Huang(黄勇) Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 9 +++++++++ tests/qemuxml2argvdata/kvm-features.args | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 65e7d77a07..8199a11b74 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7213,6 +7213,15 @@ qemuBuildAccelCommandLine(virCommand *cmd, case VIR_DOMAIN_VIRT_KVM: virBufferAddLit(&buf, "kvm"); + /* + * only handle the kvm case, tcg case use the legacy style + * not that either kvm or tcg can be specified by libvirt + * so do not worry about the conflict of specifying both + * */ + if (def->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON && + def->kvm_features->features[VIR_DOMAIN_KVM_DIRTY_RING] == VIR_TRISTATE_SWITCH_ON) { + virBufferAsprintf(&buf, ",dirty-ring-size=%d", def->kvm_features->dirty_ring_size); + } break; case VIR_DOMAIN_VIRT_KQEMU: diff --git a/tests/qemuxml2argvdata/kvm-features.args b/tests/qemuxml2argvdata/kvm-features.args index 371c382b47..1789363736 100644 --- a/tests/qemuxml2argvdata/kvm-features.args +++ b/tests/qemuxml2argvdata/kvm-features.args @@ -12,7 +12,7 @@ QEMU_AUDIO_DRV=none \ -S \ -object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine pc,usb=off,dump-guest-core=off \ --accel kvm \ +-accel kvm,dirty-ring-size=4096 \ -cpu host,kvm=off,kvm-hint-dedicated=on,kvm-poll-control=on \ -m 214 \ -realtime mlock=off \