[libvirt] libvirtd crash with host cpu model qemu64
by Jim Fehlig
I have an L1 nested VM with the following cpu
# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 2
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 6
Model: 2
Model name: QEMU Virtual CPU version 0.14
Stepping: 3
CPU MHz: 3092.210
BogoMIPS: 6184.42
Virtualization: AMD-V
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 64K
L1i cache: 64K
L2 cache: 512K
NUMA node0 CPU(s): 0,1
Flags: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 popcnt
hypervisor lahf_lm svm abm sse4a 3dnowprefetch vmmcall
When starting an L2 VM with <cpu mode="host-model">, libvirtd in the L1 VM crashes
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff739bf33 in x86DataCpuid (cpuid=0x8, cpuid=0x8,
data=data@entry=0x7fffb800ee78) at cpu/cpu_x86.c:287
287 for (i = 0; i < data->len; i++) {
(gdb) bt
f0 0x00007ffff739bf33 in x86DataCpuid (cpuid=0x8, cpuid=0x8,
data=data@entry=0x7fffb800ee78) at cpu/cpu_x86.c:287
f1 virCPUx86DataAddCPUID (data=data@entry=0x7fffb800ee78, cpuid=0x8)
at cpu/cpu_x86.c:355
f2 0x00007ffff739ef47 in x86Compute (host=<optimized out>, cpu=0x7fffb8000cc0,
guest=0x7fffecca7348, message=<optimized out>) at cpu/cpu_x86.c:1580
f3 0x00007fffd2b38e53 in qemuBuildCpuModelArgStr (migrating=false,
hasHwVirt=<synthetic pointer>, qemuCaps=0x7fffb8001040, buf=0x7fffecca7360,
def=0x7fffc400ce20, driver=0x1c) at qemu/qemu_command.c:6283
f4 qemuBuildCpuCommandLine (cmd=cmd@entry=0x7fffb8002f60,
driver=driver@entry=0x7fffc80882c0, def=def@entry=0x7fffc400ce20,
qemuCaps=qemuCaps@entry=0x7fffb8001040, migrating=<optimized out>)
at qemu/qemu_command.c:6445
In frame 2, &host_model->vendor->cpuid is passed to virCPUx86DataAddCPUID(),
but
(gdb) p *host_model
$23 = {name = 0x7fffb800ec50 "qemu64", vendor = 0x0, signature = 0, data = {
len = 2, data = 0x7fffb800e720}}
With vendor = 0x0, &host_model->vendor->cpuid evaluates to 8, which is not a
nice value to pass to virCPUx86DataAddCPUID(). I've hacked around the problem by
checking for a non-null host->vendor before calling
virCPUx86DataAddCPUID, but I get the feeling it is just that - a hack.
Comments on the attached patch, or suggestions for an alternate fix, are kindly
welcomed :-).
Regards,
Jim
8 years, 8 months
[libvirt] [PATCH 0/9] qemu: Reflect USB controller model in guest XML
by Andrea Bolognani
Patches 1-3 take care of some tiny nits; patches 4-7 clean
up the test suite and add some new test cases that cover
the code changed by subsequent patches.
Patch 8 implements the feature advertised in the subject :)
Patch 9 gets rid of some code that's no longer necessary
after the changes.
Andrea Bolognani (9):
tests: qemuxml2argv: Remove useless GIC flags
tests: qemuxml2argv: Fix usb-too-long-port-path-invalid
tests: qemuxml2xml: Fix disk-mirror
tests: qemuxml2xml: Use WHEN_BOTH for most tests
tests: qemuxml2xml: Pass capabilities to DO_TEST()
tests: qemuxml2xml: Use DO_TEST() for most tests
tests: qemuxml2xml: Add some USB test cases
qemu: domain: Reflect USB controller model in guest XML
qemu: command: Simplify USB controller model selection
src/qemu/qemu_command.c | 60 +-
src/qemu/qemu_domain.c | 20 +
tests/qemuxml2argvtest.c | 16 +-
.../qemuxml2xmlout-ppc64-usb-controller-legacy.xml | 31 +
.../qemuxml2xmlout-ppc64-usb-controller.xml | 31 +
.../qemuxml2xmlout-usb-controller-default-q35.xml | 37 +
.../qemuxml2xmlout-usb-controller-explicit-q35.xml | 37 +
.../qemuxml2xmlout-usb-controller.xml | 27 +
.../qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml | 25 +
.../qemuxml2xmlout-usb-piix3-controller.xml | 27 +
tests/qemuxml2xmltest.c | 932 ++++++++++-----------
11 files changed, 728 insertions(+), 515 deletions(-)
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-legacy.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-default-q35.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller-explicit-q35.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-controller.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-none.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-piix3-controller.xml
--
2.7.4
8 years, 8 months
[libvirt] [PATCH 0/2] Couple of virschematest fixes
by Michal Privoznik
It's true that rewriting this into C made this test run faster.
But maybe too much to my taste.
Michal Privoznik (2):
virschematest: Initialize @data
virschematest: Make sure that validator is initialized
tests/virschematest.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
--
2.8.4
8 years, 8 months
[libvirt] [PATCH v2] schema: Don't validate paths
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1353296
On UNIX like systems there are no constraints on what characters
can be in file/dir names (except for NULL, obviously). Moreover,
some values that we think of as paths (e.g. disk source) are not
necessarily paths at all. For instance, some hypervisors take
that as an arbitrary identifier and corresponding file is then
looked up by hypervisor in its table. Instead of trying to fix
our regular expressions (and forgetting to include yet another
character there), lets drop the validation completely.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v1:
- Instead of adding some more chars to whitelist, drop it
docs/schemas/basictypes.rng | 8 ++---
.../domainschemadata/domain-disk-source-space.xml | 36 ++++++++++++++++++++++
2 files changed, 40 insertions(+), 4 deletions(-)
create mode 100644 tests/domainschemadata/domain-disk-source-space.xml
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 474ad77..1b4f980 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -247,25 +247,25 @@
<define name="filePath">
<data type="string">
- <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/%]+</param>
+ <param name="pattern">.+</param>
</data>
</define>
<define name="dirPath">
<data type="string">
- <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/%]+</param>
+ <param name="pattern">.+</param>
</data>
</define>
<define name="absFilePath">
<data type="string">
- <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%,:]+</param>
+ <param name="pattern">/.+</param>
</data>
</define>
<define name="absDirPath">
<data type="string">
- <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%]*</param>
+ <param name="pattern">/.*</param>
</data>
</define>
diff --git a/tests/domainschemadata/domain-disk-source-space.xml b/tests/domainschemadata/domain-disk-source-space.xml
new file mode 100644
index 0000000..553b6c7
--- /dev/null
+++ b/tests/domainschemadata/domain-disk-source-space.xml
@@ -0,0 +1,36 @@
+<domain type='kvm'>
+ <name>dummy</name>
+ <uuid>aa86471a-e67b-41b1-8d7d-2dc37c2ac5ec</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ </features>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <pm>
+ <suspend-to-mem enabled='no'/>
+ <suspend-to-disk enabled='no'/>
+ </pm>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/a/path/with some space in it.iso'/>
+ <target dev='hda' bus='ide'/>
+ <readonly/>
+ <boot order='1'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='pci' index='0' model='pci-root'/>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ </devices>
+</domain>
--
2.8.4
8 years, 8 months
[libvirt] [PATCH] conf: Fix initialization value of 'multi' in PCI address
by Xian Han Yu
Signed-off-by: Xian Han Yu <xhyubj(a)linux.vnet.ibm.com>
---
src/conf/node_device_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index a23d8ef..96fdb6f 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1163,7 +1163,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
goto cleanup;
for (i = 0; i < nAddrNodes; i++) {
- virPCIDeviceAddress addr = { 0, 0, 0, 0, 0 };
+ virPCIDeviceAddress addr = { 0, 0, 0, 0, false };
if (virPCIDeviceAddressParseXML(addrNodes[i], &addr) < 0)
goto cleanup;
if (VIR_ALLOC(pciAddr) < 0)
--
2.5.5
8 years, 8 months
[libvirt] [PATCH] schema: Allow spaces in paths
by Michal Privoznik
Since ages filesystems allowed to have space characters in
filenames and even directory names. In fact, on all major
filesystems out there you can have whatever character you like
except NULL. There's no reason why we should forbid users to not
have spaces in their filenames. Moreover, if we do that only on
RNG schema level while our XML parser/formatter crunches that
happily.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/schemas/basictypes.rng | 8 ++---
.../domainschemadata/domain-disk-source-space.xml | 36 ++++++++++++++++++++++
2 files changed, 40 insertions(+), 4 deletions(-)
create mode 100644 tests/domainschemadata/domain-disk-source-space.xml
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 474ad77..f2b7930 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -247,25 +247,25 @@
<define name="filePath">
<data type="string">
- <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/%]+</param>
+ <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/% ]+</param>
</data>
</define>
<define name="dirPath">
<data type="string">
- <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/%]+</param>
+ <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/% ]+</param>
</data>
</define>
<define name="absFilePath">
<data type="string">
- <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%,:]+</param>
+ <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%,: ]+</param>
</data>
</define>
<define name="absDirPath">
<data type="string">
- <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%]*</param>
+ <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/% ]*</param>
</data>
</define>
diff --git a/tests/domainschemadata/domain-disk-source-space.xml b/tests/domainschemadata/domain-disk-source-space.xml
new file mode 100644
index 0000000..553b6c7
--- /dev/null
+++ b/tests/domainschemadata/domain-disk-source-space.xml
@@ -0,0 +1,36 @@
+<domain type='kvm'>
+ <name>dummy</name>
+ <uuid>aa86471a-e67b-41b1-8d7d-2dc37c2ac5ec</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ </features>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <pm>
+ <suspend-to-mem enabled='no'/>
+ <suspend-to-disk enabled='no'/>
+ </pm>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/a/path/with some space in it.iso'/>
+ <target dev='hda' bus='ide'/>
+ <readonly/>
+ <boot order='1'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='pci' index='0' model='pci-root'/>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ </devices>
+</domain>
--
2.8.4
8 years, 8 months
[libvirt] [PATCH 0/5] Introduce NVDIMM support
by Michal Privoznik
NVDIMM was introduced to qemu in v2.6.0-rc0~248^2~25. So it's
been a while since then.
It's not the next big thing, but it is very interesting feature
enabling higher performance as reading/writing to the module (and
subsequently to the file on the host) does not require a VMEXIT.
It can be used to access host files directly bypassing page cache
whilst doing so.
How to test the feature?
1) you need PMEM enabled kernel:
CONFIG_LIBNVDIMM=y
CONFIG_BLK_DEV_PMEM=m
CONFIG_ACPI_NFIT=m
2) Create a file in the host:
truncate -s 512M /tmp/nvdimm
3) Add the following to the domain XML:
<memory model='nvdimm' memAccess='shared'>
<source>
<path>/tmp/nvdimm</path>
</source>
<target>
<size unit='KiB'>523264</size>
<node>0</node>
</target>
</memory>
4) Start the domain and write something into the NVDIMM module:
(guest) $ echo 'Hello world' > /dev/pmem0
5) From the host, check the file has changed:
(host) $ hexdump -C /tmp/nvdimm
Want to watch very interesting video while reviewing?
https://youtu.be/Vit3-PjbN9M
Michal Privoznik (5):
Introduce NVDIMM memory model
qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM
qemu: Implement NVDIMM
conf: Introduce memAccess to <memory/>
qemu: Implement memAccess for <memory/> banks
docs/formatdomain.html.in | 41 ++++++--
docs/schemas/domaincommon.rng | 51 ++++++----
src/conf/domain_conf.c | 112 ++++++++++++++++-----
src/conf/domain_conf.h | 4 +
src/libvirt_private.syms | 2 +
src/qemu/qemu_alias.c | 12 ++-
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 87 +++++++++++-----
src/qemu/qemu_command.h | 2 +
src/qemu/qemu_domain.c | 29 ++++--
src/qemu/qemu_hotplug.c | 3 +-
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
.../qemuxml2argv-hugepages-numa.args | 5 +-
.../qemuxml2argv-hugepages-pages.args | 24 ++---
.../qemuxml2argv-hugepages-pages2.args | 8 +-
.../qemuxml2argv-hugepages-pages3.args | 4 +-
.../qemuxml2argv-hugepages-shared.args | 22 ++--
.../qemuxml2argv-memory-hotplug-dimm-addr.args | 5 +-
.../qemuxml2argv-memory-hotplug-dimm.args | 5 +-
...muxml2argv-memory-hotplug-nvdimm-memAccess.args | 26 +++++
...emuxml2argv-memory-hotplug-nvdimm-memAccess.xml | 49 +++++++++
.../qemuxml2argv-memory-hotplug-nvdimm.args | 25 +++++
.../qemuxml2argv-memory-hotplug-nvdimm.xml | 49 +++++++++
tests/qemuxml2argvtest.c | 6 +-
25 files changed, 452 insertions(+), 123 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-memAccess.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm.xml
--
2.8.4
8 years, 8 months
[libvirt] Failing build on rawhide
by Martin Kletzander
So after updating my fedora-rawhide machines, I started receiving an
interesting error:
In file included from /usr/include/features.h:397:0,
from /usr/include/bits/libc-header-start.h:33,
from /usr/include/stdio.h:28,
from ../gnulib/lib/stdio.h:43,
from util/vircgroup.c:26:
/usr/include/sys/sysmacros.h:88:1: note: declared here
__SYSMACROS_DEFINE_MINOR (__SYSMACROS_FST_IMPL_TEMPL)
^
util/vircgroup.c: In function 'virCgroupAllowDevicePath':
util/vircgroup.c:2944:33: error: '__major_from_sys_types' is deprecated:
In the GNU C Library, `major' is defined by <sys/sysmacros.h>.
For historical compatibility, it is currently defined by
<sys/types.h> as well, but we plan to remove this soon.
To use `major', include <sys/sysmacros.h> directly.
If you did not intend to use a system-defined macro `major',
you should #undef it after including <sys/types.h>.
[-Werror=deprecated-declarations]
major(sb.st_rdev),
^~~~~
It looks like we might need to reorder the includes, but whatever I do,
I still get the warning. Updating gnulib doesn't help, so either we
need to #undef minor/major/makedev, or maybe gnulib needs to fix that
(my guess inspired by the include stack above).
So I figured I just post my findings here and let others continue the
wondering so that I can do some more useful stuff.
Have a nice day,
Martin
8 years, 8 months
[libvirt] [PATCHv2 00/11] qemu: allow disabling certain virtio revisions
by Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=1227354
v1: https://www.redhat.com/archives/libvir-list/2016-July/msg01235.html
v2:
* probe for the qemu capability
* add the attribute to virtio1-only devices such as virtio-gpu
and virtio-input devices
* allow multiple revisions to be specified
Ján Tomko (11):
Use separate buffer for <input> subelements
Add virtio revision attribute to memballoon
Add virtio revision attribute to disks
Add virtio revision attribute to controllers
Add virtio revision attribute to filesystems
Add virtio revision attribute to interfaces
Add virtio revision to rng devices
Add virtio revision attribute to video
Add virtio revision attribute to input devices
Introduce QEMU_CAPS_DEVICE_VIRTIO_REVISION
qemu: format options for enforcing virtio revisions
docs/formatdomain.html.in | 69 ++++++++++
docs/schemas/domaincommon.rng | 37 ++++++
src/conf/domain_conf.c | 148 +++++++++++++++++++--
src/conf/domain_conf.h | 16 +++
src/qemu/qemu_capabilities.c | 6 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 56 ++++++++
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 +
.../caps_2.6.0-gicv2.aarch64.xml | 1 +
.../caps_2.6.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 +
.../qemuxml2argv-virtio-revision.args | 62 +++++++++
.../qemuxml2argv-virtio-revision.xml | 113 ++++++++++++++++
tests/qemuxml2argvtest.c | 11 ++
.../qemuxml2xmlout-virtio-revision.xml | 113 ++++++++++++++++
tests/qemuxml2xmltest.c | 2 +
19 files changed, 630 insertions(+), 11 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
--
2.7.3
8 years, 8 months