[libvirt] [PATCH] compile failure 'src/cpu/cpu_map.xml': No such file or directory'
by Amy Fong
>From 73172eeed1fcffcfae088a3059fbca0689b7437f Mon Sep 17 00:00:00 2001
From: Amy Fong <amy.fong(a)windriver.com>
Date: Mon, 23 Mar 2015 13:44:03 -0400
Subject: [PATCH] libvirt: 'src/cpu/cpu_map.xml': No such file or directory'
In some circumstances where the build tree differs from the source,
libvirt's compile will try to create the symlink for cpu_map.xml before
creating the directory $(abs_builddir)/cpu.
Add a test to create this directory if it hasn't already been created.
Signed-off-by: Amy Fong <amy.fong(a)windriver.com>
---
src/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Makefile.am b/src/Makefile.am
index 00b47e7..2e4a520 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1039,6 +1039,7 @@ libvirt_cpu_la_SOURCES = $(CPU_SOURCES)
libvirt_cpu_la_DEPENDENCIES = $(abs_builddir)/cpu/cpu_map.xml
$(abs_builddir)/cpu/cpu_map.xml:
+ if [ ! -d $(abs_builddir)/cpu ]; then $(MKDIR_P) $(abs_builddir)/cpu/; fi
$(AM_V_GEN)ln -s $(abs_srcdir)/cpu/cpu_map.xml $@
if WITH_VMX
--
2.1.4
9 years, 8 months
[libvirt] [PATCH] cpu: Add {Haswell,Broadwell}-noTSX CPU models
by Jiri Denemark
QEMU 2.3 adds these new models to cover Haswell and Broadwell CPUs with
updated microcode. Luckily, they also reverted former the machine type
specific changes to existing models. And since these changes were never
released, we don't need to hack around them in libvirt.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/cpu/cpu_map.xml | 18 ++-
tests/cputest.c | 15 ++-
tests/cputestdata/x86-Haswell-noTSX-nofallback.xml | 4 +
tests/cputestdata/x86-Haswell-noTSX.xml | 4 +
tests/cputestdata/x86-Haswell.xml | 6 +
tests/cputestdata/x86-baseline-7-result.xml | 4 +
tests/cputestdata/x86-baseline-7.xml | 24 ++++
tests/cputestdata/x86-baseline-8-result.xml | 4 +
tests/cputestdata/x86-baseline-8.xml | 28 +++++
...aswell-noTSX+Haswell,haswell,Haswell-result.xml | 6 +
...ll-noTSX+Haswell-noTSX,Haswell-noTSX-result.xml | 4 +
...+Haswell-noTSX,haswell,Haswell-noTSX-result.xml | 6 +
tests/cputestdata/x86-host-Haswell-noTSX.xml | 6 +
.../qemuxml2argv-cpu-Haswell-noTSX.args | 4 +
.../qemuxml2argv-cpu-Haswell-noTSX.xml | 21 ++++
.../qemuxml2argvdata/qemuxml2argv-cpu-Haswell.args | 4 +
.../qemuxml2argvdata/qemuxml2argv-cpu-Haswell.xml | 21 ++++
.../qemuxml2argv-cpu-Haswell2.args | 4 +
.../qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.xml | 23 ++++
.../qemuxml2argv-cpu-Haswell3.args | 4 +
.../qemuxml2argvdata/qemuxml2argv-cpu-Haswell3.xml | 23 ++++
tests/qemuxml2argvtest.c | 8 ++
tests/testutilsqemu.c | 124 +++++++++++++++------
tests/testutilsqemu.h | 6 +
24 files changed, 331 insertions(+), 40 deletions(-)
create mode 100644 tests/cputestdata/x86-Haswell-noTSX-nofallback.xml
create mode 100644 tests/cputestdata/x86-Haswell-noTSX.xml
create mode 100644 tests/cputestdata/x86-Haswell.xml
create mode 100644 tests/cputestdata/x86-baseline-7-result.xml
create mode 100644 tests/cputestdata/x86-baseline-7.xml
create mode 100644 tests/cputestdata/x86-baseline-8-result.xml
create mode 100644 tests/cputestdata/x86-baseline-8.xml
create mode 100644 tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell,Haswell-result.xml
create mode 100644 tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,Haswell-noTSX-result.xml
create mode 100644 tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell,Haswell-noTSX-result.xml
create mode 100644 tests/cputestdata/x86-host-Haswell-noTSX.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell-noTSX.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell-noTSX.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell3.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell3.xml
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 413148f..2110c0b 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -500,30 +500,40 @@
<feature name='rdtscp'/>
</model>
- <model name='Haswell'>
+ <model name='Haswell-noTSX'>
<model name='SandyBridge'/>
<feature name='fma'/>
<feature name='pcid'/>
<feature name='movbe'/>
<feature name='fsgsbase'/>
<feature name='bmi1'/>
- <feature name='hle'/>
<feature name='avx2'/>
<feature name='smep'/>
<feature name='bmi2'/>
<feature name='erms'/>
<feature name='invpcid'/>
+ </model>
+
+ <model name='Haswell'>
+ <model name='Haswell-noTSX'/>
+ <feature name='hle'/>
<feature name='rtm'/>
</model>
- <model name='Broadwell'>
- <model name='Haswell'/>
+ <model name='Broadwell-noTSX'>
+ <model name='Haswell-noTSX'/>
<feature name='3dnowprefetch'/>
<feature name='rdseed'/>
<feature name='adx'/>
<feature name='smap'/>
</model>
+ <model name='Broadwell'>
+ <model name='Broadwell-noTSX'/>
+ <feature name='hle'/>
+ <feature name='rtm'/>
+ </model>
+
<!-- AMD CPUs -->
<model name='athlon'>
<model name='pentiumpro'/>
diff --git a/tests/cputest.c b/tests/cputest.c
index 449b7d1..bf7a48f 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -122,8 +122,10 @@ cpuTestLoadMultiXML(const char *arch,
goto cleanup;
n = virXPathNodeSet("/cpuTest/cpu", ctxt, &nodes);
- if (n <= 0 || (VIR_ALLOC_N(cpus, n) < 0))
+ if (n <= 0 || (VIR_ALLOC_N(cpus, n) < 0)) {
+ fprintf(stderr, "\nNo /cpuTest/cpu elements found in %s\n", xml);
goto cleanup;
+ }
for (i = 0; i < n; i++) {
ctxt->node = nodes[i];
@@ -497,6 +499,7 @@ cpuTestRun(const char *name, const struct data *data)
static const char *model486[] = { "486" };
static const char *nomodel[] = { "nomodel" };
static const char *models[] = { "qemu64", "core2duo", "Nehalem" };
+static const char *haswell[] = { "SandyBridge", "Haswell" };
static const char *ppc_models[] = { "POWER7", "POWER7_v2.1", "POWER8_v1.0"};
static int
@@ -618,6 +621,8 @@ mymain(void)
DO_TEST_BASELINE("x86", "5", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
DO_TEST_BASELINE("x86", "6", 0, 0);
DO_TEST_BASELINE("x86", "6", VIR_CONNECT_BASELINE_CPU_MIGRATABLE, 0);
+ DO_TEST_BASELINE("x86", "7", 0, 0);
+ DO_TEST_BASELINE("x86", "8", 0, 0);
DO_TEST_BASELINE("ppc64", "incompatible-vendors", 0, -1);
DO_TEST_BASELINE("ppc64", "no-vendor", 0, 0);
@@ -646,6 +651,14 @@ mymain(void)
DO_TEST_GUESTDATA("x86", "host", "host+host-model", models, "Penryn", 0);
DO_TEST_GUESTDATA("x86", "host", "host+host-model-nofallback",
models, "Penryn", -1);
+ DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell",
+ haswell, "Haswell", 0);
+ DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX",
+ haswell, "Haswell-noTSX", 0);
+ DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback",
+ haswell, "Haswell-noTSX", -1);
+ DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX",
+ NULL, "Haswell-noTSX", 0);
DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, NULL, 0);
DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, "POWER7_v2.1", -1);
diff --git a/tests/cputestdata/x86-Haswell-noTSX-nofallback.xml b/tests/cputestdata/x86-Haswell-noTSX-nofallback.xml
new file mode 100644
index 0000000..c23c3f3
--- /dev/null
+++ b/tests/cputestdata/x86-Haswell-noTSX-nofallback.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>Haswell-noTSX</model>
+ <topology sockets='1' cores='2' threads='2'/>
+</cpu>
diff --git a/tests/cputestdata/x86-Haswell-noTSX.xml b/tests/cputestdata/x86-Haswell-noTSX.xml
new file mode 100644
index 0000000..3b74089
--- /dev/null
+++ b/tests/cputestdata/x86-Haswell-noTSX.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>Haswell-noTSX</model>
+ <topology sockets='1' cores='2' threads='2'/>
+</cpu>
diff --git a/tests/cputestdata/x86-Haswell.xml b/tests/cputestdata/x86-Haswell.xml
new file mode 100644
index 0000000..630cb99
--- /dev/null
+++ b/tests/cputestdata/x86-Haswell.xml
@@ -0,0 +1,6 @@
+<cpu match='exact'>
+ <model fallback='allow'>Haswell</model>
+ <topology sockets='1' cores='2' threads='2'/>
+ <feature name='rtm' policy='disable'/>
+ <feature name='hle' policy='disable'/>
+</cpu>
diff --git a/tests/cputestdata/x86-baseline-7-result.xml b/tests/cputestdata/x86-baseline-7-result.xml
new file mode 100644
index 0000000..2af549e
--- /dev/null
+++ b/tests/cputestdata/x86-baseline-7-result.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>Haswell-noTSX</model>
+ <vendor>Intel</vendor>
+</cpu>
diff --git a/tests/cputestdata/x86-baseline-7.xml b/tests/cputestdata/x86-baseline-7.xml
new file mode 100644
index 0000000..b7e61b1
--- /dev/null
+++ b/tests/cputestdata/x86-baseline-7.xml
@@ -0,0 +1,24 @@
+<cpuTest>
+ <cpu>
+ <arch>x86_64</arch>
+ <model>SandyBridge</model>
+ <vendor>Intel</vendor>
+ <topology sockets='1' cores='2' threads='2'/>
+ <feature name='invpcid'/>
+ <feature name='erms'/>
+ <feature name='bmi2'/>
+ <feature name='smep'/>
+ <feature name='avx2'/>
+ <feature name='bmi1'/>
+ <feature name='fsgsbase'/>
+ <feature name='movbe'/>
+ <feature name='pcid'/>
+ <feature name='fma'/>
+ </cpu>
+ <cpu>
+ <arch>x86_64</arch>
+ <model>Haswell-noTSX</model>
+ <vendor>Intel</vendor>
+ <topology sockets='1' cores='2' threads='2'/>
+ </cpu>
+</cpuTest>
diff --git a/tests/cputestdata/x86-baseline-8-result.xml b/tests/cputestdata/x86-baseline-8-result.xml
new file mode 100644
index 0000000..88226b3
--- /dev/null
+++ b/tests/cputestdata/x86-baseline-8-result.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='allow'>Broadwell-noTSX</model>
+ <vendor>Intel</vendor>
+</cpu>
diff --git a/tests/cputestdata/x86-baseline-8.xml b/tests/cputestdata/x86-baseline-8.xml
new file mode 100644
index 0000000..f1ee67d
--- /dev/null
+++ b/tests/cputestdata/x86-baseline-8.xml
@@ -0,0 +1,28 @@
+<cpuTest>
+ <cpu>
+ <arch>x86_64</arch>
+ <model>SandyBridge</model>
+ <vendor>Intel</vendor>
+ <topology sockets='1' cores='2' threads='2'/>
+ <feature name='invpcid'/>
+ <feature name='erms'/>
+ <feature name='bmi2'/>
+ <feature name='smep'/>
+ <feature name='avx2'/>
+ <feature name='bmi1'/>
+ <feature name='fsgsbase'/>
+ <feature name='movbe'/>
+ <feature name='pcid'/>
+ <feature name='fma'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='rdseed'/>
+ <feature name='adx'/>
+ <feature name='smap'/>
+ </cpu>
+ <cpu>
+ <arch>x86_64</arch>
+ <model>Broadwell-noTSX</model>
+ <vendor>Intel</vendor>
+ <topology sockets='1' cores='2' threads='2'/>
+ </cpu>
+</cpuTest>
diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell,Haswell-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell,Haswell-result.xml
new file mode 100644
index 0000000..087aa7d
--- /dev/null
+++ b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell,Haswell-result.xml
@@ -0,0 +1,6 @@
+<cpu mode='custom' match='exact'>
+ <arch>x86_64</arch>
+ <model fallback='allow'>Haswell</model>
+ <feature policy='disable' name='rtm'/>
+ <feature policy='disable' name='hle'/>
+</cpu>
diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,Haswell-noTSX-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,Haswell-noTSX-result.xml
new file mode 100644
index 0000000..f5a67fb
--- /dev/null
+++ b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,Haswell-noTSX-result.xml
@@ -0,0 +1,4 @@
+<cpu mode='custom' match='exact'>
+ <arch>x86_64</arch>
+ <model fallback='allow'>Haswell-noTSX</model>
+</cpu>
diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell,Haswell-noTSX-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell,Haswell-noTSX-result.xml
new file mode 100644
index 0000000..087aa7d
--- /dev/null
+++ b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell,Haswell-noTSX-result.xml
@@ -0,0 +1,6 @@
+<cpu mode='custom' match='exact'>
+ <arch>x86_64</arch>
+ <model fallback='allow'>Haswell</model>
+ <feature policy='disable' name='rtm'/>
+ <feature policy='disable' name='hle'/>
+</cpu>
diff --git a/tests/cputestdata/x86-host-Haswell-noTSX.xml b/tests/cputestdata/x86-host-Haswell-noTSX.xml
new file mode 100644
index 0000000..c003085
--- /dev/null
+++ b/tests/cputestdata/x86-host-Haswell-noTSX.xml
@@ -0,0 +1,6 @@
+<cpu>
+ <arch>x86_64</arch>
+ <model>Haswell-noTSX</model>
+ <vendor>Intel</vendor>
+ <topology sockets='1' cores='2' threads='2'/>
+</cpu>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell-noTSX.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell-noTSX.args
new file mode 100644
index 0000000..d64cc83
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell-noTSX.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-kvm -S -M pc -cpu Haswell-noTSX -m 214 -smp 6 \
+-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
+none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell-noTSX.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell-noTSX.xml
new file mode 100644
index 0000000..9ef24cd
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell-noTSX.xml
@@ -0,0 +1,21 @@
+<domain type='kvm'>
+ <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>
+ <cpu mode='custom' match='exact'>
+ <model fallback='forbid'>Haswell-noTSX</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell.args
new file mode 100644
index 0000000..f9bea62
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-kvm -S -M pc -cpu Haswell -m 214 -smp 6 \
+-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
+none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell.xml
new file mode 100644
index 0000000..3af49f9
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell.xml
@@ -0,0 +1,21 @@
+<domain type='kvm'>
+ <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>
+ <cpu mode='custom' match='exact'>
+ <model fallback='forbid'>Haswell</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.args
new file mode 100644
index 0000000..a398ab8
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-kvm -S -M pc -cpu Haswell,-rtm,-hle -m 214 -smp 6 \
+-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
+none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.xml
new file mode 100644
index 0000000..0d4efa1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell2.xml
@@ -0,0 +1,23 @@
+<domain type='kvm'>
+ <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>
+ <cpu mode='custom' match='exact'>
+ <model fallback='forbid'>Haswell</model>
+ <feature policy='disable' name='rtm'/>
+ <feature policy='disable' name='hle'/>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell3.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell3.args
new file mode 100644
index 0000000..f9bea62
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell3.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-kvm -S -M pc -cpu Haswell -m 214 -smp 6 \
+-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
+none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell3.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell3.xml
new file mode 100644
index 0000000..00617eb
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-Haswell3.xml
@@ -0,0 +1,23 @@
+<domain type='kvm'>
+ <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>
+ <cpu mode='custom' match='exact'>
+ <model fallback='forbid'>Haswell</model>
+ <feature policy='require' name='rtm'/>
+ <feature policy='force' name='hle'/>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 08f374e..43e00ea 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -454,6 +454,7 @@ testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
const char *newModels[] = {
"Opteron_G3", "Opteron_G2", "Opteron_G1",
"Nehalem", "Penryn", "Conroe",
+ "Haswell-noTSX", "Haswell",
};
const char *legacyModels[] = {
"n270", "athlon", "pentium3", "pentium2", "pentium",
@@ -1253,6 +1254,13 @@ mymain(void)
DO_TEST_FAILURE("cpu-qemu-host-passthrough",
QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
+ driver.caps->host.cpu = cpuHaswell;
+ DO_TEST("cpu-Haswell", QEMU_CAPS_KVM);
+ DO_TEST("cpu-Haswell2", QEMU_CAPS_KVM);
+ DO_TEST("cpu-Haswell3", QEMU_CAPS_KVM);
+ DO_TEST("cpu-Haswell-noTSX", QEMU_CAPS_KVM);
+ driver.caps->host.cpu = cpuDefault;
+
DO_TEST("memtune", QEMU_CAPS_NAME);
DO_TEST("memtune-unlimited", QEMU_CAPS_NAME);
DO_TEST("blkiotune", QEMU_CAPS_NAME);
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index d72e7d8..7c581a1 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -12,6 +12,83 @@
# define VIR_FROM_THIS VIR_FROM_QEMU
+virCPUDefPtr cpuDefault;
+virCPUDefPtr cpuHaswell;
+
+static virCPUFeatureDef cpuDefaultFeatures[] = {
+ { (char *) "lahf_lm", -1 },
+ { (char *) "xtpr", -1 },
+ { (char *) "cx16", -1 },
+ { (char *) "tm2", -1 },
+ { (char *) "est", -1 },
+ { (char *) "vmx", -1 },
+ { (char *) "ds_cpl", -1 },
+ { (char *) "pbe", -1 },
+ { (char *) "tm", -1 },
+ { (char *) "ht", -1 },
+ { (char *) "ss", -1 },
+ { (char *) "acpi", -1 },
+ { (char *) "ds", -1 }
+};
+static virCPUDef cpuDefaultData = {
+ VIR_CPU_TYPE_HOST, /* type */
+ 0, /* mode */
+ 0, /* match */
+ VIR_ARCH_X86_64, /* arch */
+ (char *) "core2duo", /* model */
+ NULL, /* vendor_id */
+ 0, /* fallback */
+ (char *) "Intel", /* vendor */
+ 1, /* sockets */
+ 2, /* cores */
+ 1, /* threads */
+ ARRAY_CARDINALITY(cpuDefaultFeatures), /* nfeatures */
+ ARRAY_CARDINALITY(cpuDefaultFeatures), /* nfeatures_max */
+ cpuDefaultFeatures, /* features */
+};
+
+static virCPUFeatureDef cpuHaswellFeatures[] = {
+ { (char *) "lahf_lm", -1 },
+ { (char *) "invtsc", -1 },
+ { (char *) "abm", -1 },
+ { (char *) "pdpe1gb", -1 },
+ { (char *) "rdrand", -1 },
+ { (char *) "f16c", -1 },
+ { (char *) "osxsave", -1 },
+ { (char *) "pdcm", -1 },
+ { (char *) "xtpr", -1 },
+ { (char *) "tm2", -1 },
+ { (char *) "est", -1 },
+ { (char *) "smx", -1 },
+ { (char *) "vmx", -1 },
+ { (char *) "ds_cpl", -1 },
+ { (char *) "monitor", -1 },
+ { (char *) "dtes64", -1 },
+ { (char *) "pbe", -1 },
+ { (char *) "tm", -1 },
+ { (char *) "ht", -1 },
+ { (char *) "ss", -1 },
+ { (char *) "acpi", -1 },
+ { (char *) "ds", -1 },
+ { (char *) "vme", -1 },
+};
+static virCPUDef cpuHaswellData = {
+ VIR_CPU_TYPE_HOST, /* type */
+ 0, /* mode */
+ 0, /* match */
+ VIR_ARCH_X86_64, /* arch */
+ (char *) "Haswell", /* model */
+ NULL, /* vendor_id */
+ 0, /* fallback */
+ (char *) "Intel", /* vendor */
+ 1, /* sockets */
+ 2, /* cores */
+ 2, /* threads */
+ ARRAY_CARDINALITY(cpuHaswellFeatures), /* nfeatures */
+ ARRAY_CARDINALITY(cpuHaswellFeatures), /* nfeatures_max */
+ cpuHaswellFeatures, /* features */
+};
+
static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines)
{
virCapsGuestMachinePtr *machines;
@@ -239,40 +316,8 @@ virCapsPtr testQemuCapsInit(void)
static const char *const xen_machines[] = {
"xenner"
};
- static virCPUFeatureDef host_cpu_features[] = {
- { (char *) "lahf_lm", -1 },
- { (char *) "xtpr", -1 },
- { (char *) "cx16", -1 },
- { (char *) "tm2", -1 },
- { (char *) "est", -1 },
- { (char *) "vmx", -1 },
- { (char *) "ds_cpl", -1 },
- { (char *) "pbe", -1 },
- { (char *) "tm", -1 },
- { (char *) "ht", -1 },
- { (char *) "ss", -1 },
- { (char *) "acpi", -1 },
- { (char *) "ds", -1 }
- };
- static virCPUDef host_cpu = {
- VIR_CPU_TYPE_HOST, /* type */
- 0, /* mode */
- 0, /* match */
- VIR_ARCH_X86_64, /* arch */
- (char *) "core2duo", /* model */
- NULL, /* vendor_id */
- 0, /* fallback */
- (char *) "Intel", /* vendor */
- 1, /* sockets */
- 2, /* cores */
- 1, /* threads */
- ARRAY_CARDINALITY(host_cpu_features), /* nfeatures */
- ARRAY_CARDINALITY(host_cpu_features), /* nfeatures_max */
- host_cpu_features, /* features */
- };
- if ((caps = virCapabilitiesNew(host_cpu.arch,
- false, false)) == NULL)
+ if (!(caps = virCapabilitiesNew(VIR_ARCH_X86_64, false, false)))
return NULL;
/* Add dummy 'none' security_driver. This is equal to setting
@@ -285,8 +330,13 @@ virCapsPtr testQemuCapsInit(void)
VIR_STRDUP(caps->host.secModels[0].doi, "0") < 0)
goto cleanup;
- if ((caps->host.cpu = virCPUDefCopy(&host_cpu)) == NULL ||
- (machines = testQemuAllocMachines(&nmachines)) == NULL)
+ if (!(cpuDefault = virCPUDefCopy(&cpuDefaultData)) ||
+ !(cpuHaswell = virCPUDefCopy(&cpuHaswellData)))
+ goto cleanup;
+
+ caps->host.cpu = cpuDefault;
+
+ if ((machines = testQemuAllocMachines(&nmachines)) == NULL)
goto cleanup;
if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686,
@@ -386,6 +436,10 @@ virCapsPtr testQemuCapsInit(void)
cleanup:
virCapabilitiesFreeMachines(machines, nmachines);
+ if (caps->host.cpu != cpuDefault)
+ virCPUDefFree(cpuDefault);
+ if (caps->host.cpu != cpuHaswell)
+ virCPUDefFree(cpuHaswell);
virObjectUnref(caps);
return NULL;
}
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index 79ee143..0ec5dad 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -10,4 +10,10 @@ virDomainXMLOptionPtr testQemuXMLConfInit(void);
extern qemuBuildCommandLineCallbacks testCallbacks;
virQEMUCapsPtr qemuTestParseCapabilities(const char *capsFile);
+
+extern virCPUDefPtr cpuDefault;
+extern virCPUDefPtr cpuHaswell;
+void testQemuCapsSetCPU(virCapsPtr caps,
+ virCPUDefPtr hostCPU);
+
#endif
--
2.3.3
9 years, 8 months
[libvirt] [PATCH] hostdev: fix two bugs in virHostdevReAttachPCIDevices
by Huanle Han
Bug 1: The the next element in the pcidevs is skipped after we
virPCIDeviceListDel the previous element.
Bug 2: virHostdevNetConfigRestore is called for store the hostdevs
which may be used by other domain.
Signed-off-by: Huanle Han <hanxueluo(a)gmail.com>
---
src/util/virhostdev.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 9678e2b..ecbe5d8 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -785,7 +785,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr
hostdev_mgr,
* them and reset all the devices before re-attach.
* Attach mac and port profile parameters to devices
*/
- for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
+ for (i = 0; i < virPCIDeviceListCount(pcidevs);) {
virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
virPCIDevicePtr activeDev = NULL;
@@ -806,6 +806,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr
hostdev_mgr,
}
virPCIDeviceListDel(hostdev_mgr->activePCIHostdevs, dev);
+ i++;
}
/* At this point, any device that had been used by the guest is in
@@ -816,9 +817,25 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr
hostdev_mgr,
* For SRIOV net host devices, unset mac and port profile before
* reset and reattach device
*/
- for (i = 0; i < nhostdevs; i++)
- virHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir,
- oldStateDir);
+ for (i = 0; i < nhostdevs; i++) {
+ virPCIDevicePtr dev;
+ virDomainHostdevDefPtr hostdev = hostdevs[i];
+ virDomainHostdevSubsysPCIPtr pcisrc =
&hostdev->source.subsys.u.pci;
+
+ if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
+ hostdev->source.subsys.type !=
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI ||
+ hostdev->parent.type != VIR_DOMAIN_DEVICE_NET ||
+ !hostdev->parent.data.net)
+ continue;
+
+ dev = virPCIDeviceNew(pcisrc->addr.domain, pcisrc->addr.bus,
+ pcisrc->addr.slot, pcisrc->addr.function);
+ if (virPCIDeviceListFind(pcidevs, dev)) {
+ virHostdevNetConfigRestore(hostdev, hostdev_mgr->stateDir,
+ oldStateDir);
+ }
+ virPCIDeviceFree(dev);
+ }
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
--
2.1.0
9 years, 8 months
[libvirt] [PATCHv2 0/2] Test status XML formatting and parsing
by Peter Krempa
Peter Krempa (2):
util: buffer: Add support for adding text blocks with indentation
tests: qemuxml2xml: Test status XML formatting and parsing
src/conf/domain_conf.c | 4 +-
src/conf/domain_conf.h | 9 ++++
src/libvirt_private.syms | 3 ++
src/util/virbuffer.c | 29 +++++++++++++
src/util/virbuffer.h | 1 +
tests/qemuxml2xmltest.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++
tests/virbuftest.c | 49 +++++++++++++++++++++
7 files changed, 204 insertions(+), 2 deletions(-)
--
2.2.2
9 years, 8 months
[libvirt] [PATCH] Relax filesystem target type
by Guido Günther
When using QEMU's 9pfs the target "dir" element is not necessarily an
absolute path. If it is not validation currently fails with the
misleaading
$ virt-xml-validate /tmp/test.xml
Relax-NG validity error : Extra element devices in interleave
/tmp/test.xml:24: element devices: Relax-NG validity error : Element domain failed to validate content
/tmp/test.xml fails to validate
---
docs/schemas/domaincommon.rng | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index ebd9299..c6b1a05 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2010,7 +2010,7 @@
<interleave>
<element name="target">
<attribute name="dir">
- <ref name="absDirPath"/>
+ <ref name="dirPath"/>
</attribute>
<empty/>
</element>
--
2.1.4
9 years, 8 months
[libvirt] [PATCH v3 0/2] network_conf: check if bridge exists on host for user created bridges
by Shivaprasad G Bhat
The patch fixes the below problem.
==============================
If the bridge name is not mentioned in the <network> xml, the bridge name is
auto generated from virNetworkAllocateBridge(). If the default template named
bridge is created manually by a user, the bridge start will fail with
"File exists".
bash-4.3$ sudo brctl addbr virbr1
bash-4.3$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000000000000 no
virbr0 8000.525400a91d03 yes virbr0-nic
virbr1 8000.000000000000 no
bash-4.3$ sudo virsh net-list --all
Name State Autostart Persistent
----------------------------------------------------------
default active no yes
bash-4.3$ cat /tmp/isolated # Notice that the <bridge> intentionally not given.
<network>
<name>isolated</name>
<forward/>
<ip address="192.168.123.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.123.2" end="192.168.123.254"/>
</dhcp>
</ip>
</network>
bash-4.3$ sudo virsh net-create /tmp/isolated
error: Failed to create network from isolated
error: Unable to create bridge virbr1: File exists
===============================
---
Shivaprasad G Bhat (2):
cleanup conf/device_conf.h inclusion from util/virnetdev.h
network_conf: check if bridge exists on host for user created bridges
src/conf/device_conf.h | 38 +-------------------------------------
src/conf/network_conf.c | 15 ++++++++++++---
src/util/virnetdev.h | 38 +++++++++++++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 41 deletions(-)
--
Signature
9 years, 8 months
[libvirt] [PATCH 0/3] Fix crash when relaying objects and closing connection at the same time
by Peter Krempa
Fix the crash and clean up two related places.
Peter Krempa (3):
util: identity: Harden virIdentitySetCurrent()
daemon: Clear fake domain def object that is used to check ACL prior
to use
rpc: Don't unref identity object while callbacks still can be executed
daemon/remote.c | 1 +
src/rpc/virnetserverclient.c | 4 ++--
src/util/viridentity.c | 4 +++-
3 files changed, 6 insertions(+), 3 deletions(-)
--
2.2.2
9 years, 8 months
[libvirt] [PATCH 0/4] Test status XML formatting and parsing
by Peter Krempa
A recent bug showed that the status XML parsing is not tested. Add test cases
based on existing tests in the XML-2-XML test to excercise the parser.
Additionally this series fixes also a memleak of the domain device alias list.
Peter Krempa (4):
qemu: domain: Don't leak device alias list
util: buffer: Add support for adding text blocks with indentation
tests: xml2xml: Refactor the qemu xml 2 xml test
test: qemuxml2xml: Test status XML formatting and parsing
src/conf/domain_conf.c | 4 +-
src/conf/domain_conf.h | 9 ++
src/libvirt_private.syms | 3 +
src/qemu/qemu_domain.c | 1 +
src/util/virbuffer.c | 38 ++++++
src/util/virbuffer.h | 1 +
tests/qemuxml2xmltest.c | 309 ++++++++++++++++++++++++++++++++++++-----------
tests/virbuftest.c | 50 ++++++++
8 files changed, 345 insertions(+), 70 deletions(-)
--
2.2.2
9 years, 8 months
[libvirt] [PATCH 1/2] util: NUMA: Change error code in virNumaNodesetIsAvailable()
by Peter Krempa
An invalid nodeset is a configuration problem rather than an internal
error.
---
Pushed as trivial.
src/util/virnuma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index e986c71..669192a 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -977,7 +977,7 @@ virNumaNodesetIsAvailable(virBitmapPtr nodeset)
if (virNumaNodeIsAvailable(bit))
continue;
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("NUMA node %zd is unavailable"), bit);
return false;
}
--
2.2.2
9 years, 8 months
[libvirt] Plans for next release
by Daniel Veillard
So we already have around 300 commits made since 1.2.13, and
the end of the month is coming, so I guess we should enter freeze
soon.
I would suggest to do this friday to try to shoot for a 1.2.14
release by April 1st - always a great date to ship a release !
any opposition to this plan ?
BTW as was pointed earlier by pkrempa we just went over 19,000 commits
for libvirt. At the current rate we should hit 20k around july :-)
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
9 years, 8 months