From nobody Sun Feb 8 19:21:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1493146154072131.34018425929787; Tue, 25 Apr 2017 11:49:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 529673D97F; Tue, 25 Apr 2017 18:49:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2834019146; Tue, 25 Apr 2017 18:49:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C77E65EC63; Tue, 25 Apr 2017 18:49:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3PImoqY030787 for ; Tue, 25 Apr 2017 14:48:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9DDCF79C7C; Tue, 25 Apr 2017 18:48:50 +0000 (UTC) Received: from mamuti.net (ovpn-204-59.brq.redhat.com [10.40.204.59]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E1EB7BE4B for ; Tue, 25 Apr 2017 18:48:47 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 844F1103EA3; Tue, 25 Apr 2017 20:48:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 529673D97F Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 529673D97F From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 25 Apr 2017 20:48:45 +0200 Message-Id: <595c07264e0cdb3b27b209bbc9f4fcb32287d31b.1493145823.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] qemu: Add support for guest CPU cache X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 25 Apr 2017 18:49:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch maps /domain/cpu/cache element into -cpu parameters: - is translated to host-cache-info=3Don - is transformed into l3-cache=3Don - is turned in host-cache-info=3Doff,l3-cache=3Do= ff Any other element is forbidden. The tricky part is detecting whether QEMU supports the CPU properties. The 'host-cache-info' property is introduced in v2.4.0-1389-ge265e3e480, earlier QEMU releases enabled host-cache-info by default and had no way to disable it. If the property is present, it defaults to 'off' for any QEMU until at least 2.9.0. The 'l3-cache' property was introduced later by v2.7.0-200-g14c985cffa. Earlier versions worked as if l3-cache=3Doff was passed. For any QEMU until at least 2.9.0 l3-cache is 'off' by default. QEMU 2.9.0 was the first release which supports probing both properties by running device-list-properties with typename=3Dhost-x86_64-cpu. Older QEMU releases did not support device-list-properties command for CPU devices. Thus we can't really rely on probing them and we can just use query-cpu-model-expansion QMP command as a witness. Because the cache property probing is only reliable for QEMU >=3D 2.9.0 when both are already supported for quite a few releases, we let QEMU report an error if a specific cache mode is explicitly requested. The other mode (or both if a user requested CPU cache to be disabled) is explicitly turned off for QEMU >=3D 2.9.0 to avoid any surprises in case the QEMU defaults change. Any older QEMU already turns them off so not doing so explicitly does not make any harm. Signed-off-by: Jiri Denemark --- src/qemu/qemu_capabilities.c | 8 ++++ src/qemu/qemu_capabilities.h | 2 + src/qemu/qemu_command.c | 37 +++++++++++++++ src/qemu/qemu_domain.c | 54 ++++++++++++++++++= ++++ tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 2 + .../qemuxml2argv-cpu-cache-disable.args | 21 +++++++++ .../qemuxml2argv-cpu-cache-disable.xml | 20 ++++++++ .../qemuxml2argv-cpu-cache-disable2.args | 21 +++++++++ .../qemuxml2argv-cpu-cache-disable2.xml | 20 ++++++++ .../qemuxml2argv-cpu-cache-disable3.args | 22 +++++++++ .../qemuxml2argv-cpu-cache-disable3.xml | 20 ++++++++ .../qemuxml2argv-cpu-cache-emulate-l2.xml | 20 ++++++++ .../qemuxml2argv-cpu-cache-emulate-l3.args | 21 +++++++++ .../qemuxml2argv-cpu-cache-emulate-l3.xml | 20 ++++++++ .../qemuxml2argv-cpu-cache-passthrough-l3.xml | 20 ++++++++ .../qemuxml2argv-cpu-cache-passthrough.args | 21 +++++++++ .../qemuxml2argv-cpu-cache-passthrough.xml | 20 ++++++++ .../qemuxml2argv-cpu-cache-passthrough2.args | 21 +++++++++ .../qemuxml2argv-cpu-cache-passthrough2.xml | 20 ++++++++ .../qemuxml2argv-cpu-cache-passthrough3.xml | 20 ++++++++ tests/qemuxml2argvtest.c | 16 +++++++ 21 files changed, 426 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.a= rgs create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.x= ml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.= args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.= xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.= args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.= xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l= 2.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l= 3.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l= 3.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrou= gh-l3.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrou= gh.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrou= gh.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrou= gh2.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrou= gh2.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrou= gh3.xml diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index cc3e1f808..5dd18f3c5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -364,6 +364,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "query-cpu-definitions", /* 250 */ "block-write-threshold", "query-named-block-nodes", + "cpu-host-cache", + "cpu-l3-cache", ); =20 =20 @@ -4787,6 +4789,12 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM)) virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM); =20 + if (ARCH_IS_X86(qemuCaps->arch) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST_CACHE); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_L3_CACHE); + } + ret =3D 0; cleanup: return ret; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index a7eec52a9..b4f35012f 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -401,6 +401,8 @@ typedef enum { QEMU_CAPS_QUERY_CPU_DEFINITIONS, /* qmp query-cpu-definitions */ QEMU_CAPS_BLOCK_WRITE_THRESHOLD, /* BLOCK_WRITE_THRESHOLD event */ QEMU_CAPS_QUERY_NAMED_BLOCK_NODES, /* qmp query-named-block-nodes */ + QEMU_CAPS_CPU_HOST_CACHE, /* host cpu supports host-cache-info propert= y */ + QEMU_CAPS_CPU_L3_CACHE, /* -cpu supports l3-cache property */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1116d2cd5..eb7404ead 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7063,6 +7063,43 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, have_cpu =3D true; } =20 + if (def->cpu && def->cpu->cache) { + virCPUCacheDefPtr cache =3D def->cpu->cache; + bool hostOff =3D false; + bool l3Off =3D false; + + if (!have_cpu) + virBufferAdd(&buf, default_model, -1); + + switch (cache->mode) { + case VIR_CPU_CACHE_MODE_EMULATE: + virBufferAddLit(&buf, ",l3-cache=3Don"); + hostOff =3D true; + break; + + case VIR_CPU_CACHE_MODE_PASSTHROUGH: + virBufferAddLit(&buf, ",host-cache-info=3Don"); + l3Off =3D true; + break; + + case VIR_CPU_CACHE_MODE_DISABLE: + hostOff =3D l3Off =3D true; + break; + + case VIR_CPU_CACHE_MODE_LAST: + break; + } + + if (hostOff && + def->cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_HOST_CACHE)) + virBufferAddLit(&buf, ",host-cache-info=3Doff"); + + if (l3Off && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_L3_CACHE)) + virBufferAddLit(&buf, ",l3-cache=3Doff"); + } + if (virBufferCheckError(&buf) < 0) goto cleanup; =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 00b0b4ac4..dcce9134c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2714,6 +2714,60 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def) if (!def->cpu) return 0; =20 + if (def->cpu->cache) { + virCPUCacheDefPtr cache =3D def->cpu->cache; + + if (!ARCH_IS_X86(def->os.arch)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU cache specification is not supported " + "for '%s' architecture"), + virArchToString(def->os.arch)); + return -1; + } + + switch (cache->mode) { + case VIR_CPU_CACHE_MODE_EMULATE: + if (cache->level !=3D 3) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU cache mode '%s' can only be used wit= h " + "level=3D'3'"), + virCPUCacheModeTypeToString(cache->mode)); + return -1; + } + break; + + case VIR_CPU_CACHE_MODE_PASSTHROUGH: + if (def->cpu->mode !=3D VIR_CPU_MODE_HOST_PASSTHROUGH) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU cache mode '%s' can only be used wit= h " + "'%s' CPUs"), + virCPUCacheModeTypeToString(cache->mode), + virCPUModeTypeToString(VIR_CPU_MODE_HOST_PA= SSTHROUGH)); + return -1; + } + + if (cache->level !=3D -1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported CPU cache level for mode '%s= '"), + virCPUCacheModeTypeToString(cache->mode)); + return -1; + } + break; + + case VIR_CPU_CACHE_MODE_DISABLE: + if (cache->level !=3D -1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported CPU cache level for mode '%s= '"), + virCPUCacheModeTypeToString(cache->mode)); + return -1; + } + break; + + case VIR_CPU_CACHE_MODE_LAST: + break; + } + } + /* Nothing to be done if only CPU topology is specified. */ if (def->cpu->mode =3D=3D VIR_CPU_MODE_CUSTOM && !def->cpu->model) diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.9.0.x86_64.xml index 6386c4ed0..8e417f47b 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -207,6 +207,8 @@ + + 2008090 0 (v2.9.0-rc0-142-g940a8ce) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.args b/t= ests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.args new file mode 100644 index 000000000..b4976a53c --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.args @@ -0,0 +1,21 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name foo \ +-S \ +-M pc \ +-cpu host,host-cache-info=3Doff,l3-cache=3Doff \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.xml b/te= sts/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.xml new file mode 100644 index 000000000..e6f39951c --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.args b/= tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.args new file mode 100644 index 000000000..b024d8209 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.args @@ -0,0 +1,21 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name foo \ +-S \ +-M pc \ +-cpu host \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.xml b/t= ests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.xml new file mode 100644 index 000000000..e6f39951c --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.args b/= tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.args new file mode 100644 index 000000000..19a2e9609 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.args @@ -0,0 +1,22 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name foo \ +-S \ +-M pc \ +-cpu core2duo,+ds,+acpi,+ss,+ht,+tm,+pbe,+ds_cpl,+vmx,+est,+tm2,+cx16,+xtp= r,\ ++lahf_lm,l3-cache=3Doff \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.xml b/t= ests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.xml new file mode 100644 index 000000000..17078a1e8 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l2.xml b= /tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l2.xml new file mode 100644 index 000000000..4757e85ea --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l2.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.args = b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.args new file mode 100644 index 000000000..31fbadaaf --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.args @@ -0,0 +1,21 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name foo \ +-S \ +-M pc \ +-cpu host,l3-cache=3Don,host-cache-info=3Doff \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.xml b= /tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.xml new file mode 100644 index 000000000..17019c673 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough-l3.x= ml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough-l3.xml new file mode 100644 index 000000000..3471115ea --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough-l3.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.args= b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.args new file mode 100644 index 000000000..fdc73b493 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.args @@ -0,0 +1,21 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name foo \ +-S \ +-M pc \ +-cpu host,host-cache-info=3Don,l3-cache=3Doff \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.xml = b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.xml new file mode 100644 index 000000000..74846fdd3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.arg= s b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.args new file mode 100644 index 000000000..cf4c55ca3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.args @@ -0,0 +1,21 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name foo \ +-S \ +-M pc \ +-cpu host,host-cache-info=3Don \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.xml= b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.xml new file mode 100644 index 000000000..74846fdd3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough3.xml= b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough3.xml new file mode 100644 index 000000000..6ad65700b --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough3.xml @@ -0,0 +1,20 @@ + + foo + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + + + destroy + restart + destroy + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c1b014b7d..15765fdfd 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2513,6 +2513,22 @@ mymain(void) DO_TEST("cpu-check-default-partial", QEMU_CAPS_KVM); DO_TEST("cpu-check-default-partial2", QEMU_CAPS_KVM); =20 + DO_TEST("cpu-cache-disable", + QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST_CACHE, QEMU_CAPS_CPU_L3_CACH= E); + DO_TEST("cpu-cache-disable2", + QEMU_CAPS_KVM); + DO_TEST("cpu-cache-disable3", + QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST_CACHE, QEMU_CAPS_CPU_L3_CACH= E); + DO_TEST("cpu-cache-passthrough", + QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST_CACHE, QEMU_CAPS_CPU_L3_CACH= E); + DO_TEST("cpu-cache-passthrough2", + QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST_CACHE); + DO_TEST("cpu-cache-emulate-l3", + QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST_CACHE, QEMU_CAPS_CPU_L3_CACH= E); + DO_TEST_PARSE_ERROR("cpu-cache-emulate-l2", QEMU_CAPS_KVM); + DO_TEST_PARSE_ERROR("cpu-cache-passthrough3", QEMU_CAPS_KVM); + DO_TEST_PARSE_ERROR("cpu-cache-passthrough-l3", QEMU_CAPS_KVM); + qemuTestDriverFree(&driver); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list