[libvirt] [PATCH v4 0/8] CPU Model Baseline and Comparison for s390x
by Collin Walling
Changelog:
v3
- rebased on master
v2
- numerous cleanups
- removed "policy fix function" and now properly check
for policy == -1 in the CPUDef -> JSON parser
- resolved some memory leaks
- added string arg to qemuMonitorJSONParseCPUModelData for
error message to print out proper command name
v1
- introduce baseline
- split patches into small chunks
- free'd lingering qemuMonitorCPUModelInfo pointer
- when converting from virCPUDef -> virJSON, consider
feature policy FORCED for enabled
___
To run these patches, execute the virsh hypervisor-cpu-compare or
hypervisor-cpu-baseline commands and pass an XML file describing one or
more CPU definition. You can use the definition from virsh domcapabilities
or from a guest XML. There is no need extract it from the file and place
it a new one, as the XML parser will look specifically for the CPU tags.
___
These patches hookup the virsh hypervisor-cpu-compare/baseline commands
for the s390x architecture. They take an XML file describing some CPU
definitions and passes the data to QEMU, where the actual CPU model
comparison / baseline calculation is handled (available since QEMU 2.8.5).
These calculations are compared against / baselined with the hypervisor
CPU model, which can be observed via the virsh domcapabilities command
for s390x.
When baselining CPU models and the user appends the --features argument
to the command, s390x will only report back features that supersede the
base model definition.
*NOTE* if the --features flag is intended to expand /ALL/ features
available to a CPU model (such as the huge list of features reported
by a full CPU model expansion), please let me know and I can resolve
this.
The first patch pulls some code out of the CPU Model Expansion JSON
function so that it can be later used for the Comparison and Baseline
JSON functions.
The rest of the patches follow this sequence:
- introduce JSON monitor functions
- introduce capability and update test files
- hook up monitor functions to virsh command
Patch 7 pulls out some code from the CPUDef XML parser to be
reused in the comparison hookup.
Thanks.
x86 and Power review by Daniel Henrique Barboza (thanks!)
Collin Walling (8):
qemu_monitor: helper functions for CPU models
qemu_monitor: implement query-cpu-model-baseline
qemu_capabilities: introduce QEMU_CAPS_QUERY_CPU_MODEL_BASELINE
qemu_driver: hook up query-cpu-model-baseline
qemu_monitor: implement query-cpu-model-comparison
qemu_capabilities: introduce QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON
cpu_conf: xml to cpu definition parse helper
qemu_driver: hook up query-cpu-model-comparison
src/conf/cpu_conf.c | 30 +++
src/conf/cpu_conf.h | 6 +
src/cpu/cpu.c | 14 +-
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 136 +++++++++++
src/qemu/qemu_capabilities.h | 18 ++
src/qemu/qemu_driver.c | 38 +++
src/qemu/qemu_monitor.c | 44 ++++
src/qemu/qemu_monitor.h | 18 ++
src/qemu/qemu_monitor_json.c | 297 ++++++++++++++++++++---
src/qemu/qemu_monitor_json.h | 20 ++
tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml | 2 +
18 files changed, 587 insertions(+), 49 deletions(-)
--
2.7.4
5 years, 3 months
[libvirt] [PATCH v3 00/48] Split the libvirtd daemon into per-driver daemons
by Daniel P. Berrangé
This is what all the driver refactoring I've done has been about
enabling.
We gain new daemons for each driver, for the primary virt drivers:
virtlibxld
virtlxcd
virtqemud
virtvboxd
virtvzd
And again for the secondary drivers
virtinterfaced
virtnetworkd
virtnodedevd
virtnwfilterd
virtsecretd
virtstoraged
Finally to support IP connectivity, and also the legacy lbivirtd UNIX
domain socket (for the old libvirt remote driver SSH tunnelling):
virtproxyd
The the sake of facilitating upgrades, the existing libvirtd still
exists and works the same way it always has.
You either run libvirtd, or you run the per-driver daemons, never both.
The remote driver will look to see whether libvirtd is running to figure
out whether to connect to libvirtd or the new per-driver daemons.
When auto-spawning daemons for nonroot users, we default to spawning the
per-driver daemons.
This can be controlled with a UR parameter "?mode=direct|legacy|auto",
where 'direct' means per-driver and 'legacy' means libvirtd (or indirect
via virtproxyd if that's running).
Changed in v3:
- Add identity forwarding between daemons for polkit auth
- Make virtxend sockets conditional on Xen kernel
- Other misc review fixes
Changed in v2:
- Added systemd unit files for service & sockets, ensuring
conflicts with libvirtd
- Fixed proxy to actually handle probing of URIs (still not
quite perfect)
- Renamed virtlibxld to virtxend as "xen" is the user facing
name of the URI
- Lazy loading of secondary drivers, so connecting to virtqemud
does't auto-spawn all secondary driver daemons, until a
relevant API is actually invoked
- Actually generated config files / augeas files per daemon
- Abort daemon startup if driver fails to load
- Many other fixes
A few nice to have things, but not merge blocking
- MAYBE make it possible to disable build of libvirtd, or of the per-driver
daemons so downstream vendors can decide which to ship. Alternatively
they can just not include the binary in the package file list ?
- Tuning of the daemon defaults for worker threads to better suit
the fact that we have per-driver daemons
- More work on RPM packaging to allow install of per-driver daemosn
without pulling in libvirtd too
Daniel P. Berrangé (48):
build: make augeas-gentest.pl write to stdout
build: collapse rules adding augeas tests to CLEANFILES
build: create all augeas test files in same dir as their source
build: use a common rule for checking augeas test data files
build: centralize rule for handling generated config files
remote: stop trying to print help as giant blocks of text
remote: conditionalize socket names in libvirtd daemon
remote: conditionalize daemon name in libvirtd daemon
remote: conditionalize driver loading in libvirtd daemon
remote: conditionalize IP socket usage in libvirtd daemon
build: use @CONFIG@ instead of ::CONFIG:: in augeas tests
remote: conditionalize IP socket config in libvirtd.conf
remote: conditionalize IP socket config in augeas definitions
remote: refactor & rename variables for building libvirtd
build: don't hardcode /etc in the config related files
remote: reduce duplication in systemd unit file make rules into one
remote: conditionalize systemd socket unit files
remote: refactor how list of systemd unit files is built
remote: in per-driver daemons ensure that state initialize succeeds
remote: introduce virtproxyd daemon to handle IP connectivity
secret: introduce virtsecretd daemon
network: introduce virtnetworkd daemon
interface: introduce virtinterfaced daemon
storage: introduce virtstoraged daemon
nodedev: introduce virtnodedevd daemon
nwfilter: introduce virtnwfilterd daemon
libxl: introduce virtxend daemon
qemu: introduce virtqemud daemon
lxc: introduce virtlxcd daemon
vbox: introduce virtvboxd daemon
bhyve: introduce virtbhyved daemon
vz: introduce virtvzd daemon
admin: add ability to connect to the per-driver daemon sockets
remote: get rid of bogus ATTRIBUTE_UNUSED annotation client param
remote: change generated methods to not directly access connection
remote: fix lock ordering mistake in event registration
remote: change hand written methods to not directly access connection
remote: open secondary drivers via remote driver if needed
remote: handle autoprobing of driver within virtproxyd
remote: use enum helpers for parsing remote driver transport
remote: refactor the code for choosing the UNIX socket path
remote: enable connecting to the per-driver daemons
api: introduce virConnectSetIdentity for pasing uid, gid, selinux info
util: change identity class attribute names
util: make generic identity accessors private
util: storage identity attrs as virTypedParameter internally
util: allow identity to be imported/exported as typed parameters
remote: pass identity across to newly opened daemons
.gitignore | 62 +-
build-aux/augeas-gentest.pl | 22 +-
docs/remote.html.in | 18 +
include/libvirt/libvirt-host.h | 75 +
libvirt.spec.in | 91 ++
m4/virt-driver-remote.m4 | 15 +
src/Makefile.am | 30 +-
src/access/viraccessdriverpolkit.c | 12 +-
src/admin/admin_server.c | 10 +-
src/admin/admin_server_dispatch.c | 9 +
src/bhyve/Makefile.inc.am | 55 +-
src/bhyve/bhyve_driver.c | 10 +-
src/bhyve/test_libvirtd_bhyve.aug.in | 2 +-
src/driver-hypervisor.h | 7 +
src/driver-state.h | 8 +-
src/driver.h | 2 +
src/interface/Makefile.inc.am | 62 +
src/interface/interface_backend_netcf.c | 8 +-
src/interface/interface_backend_udev.c | 4 +-
src/interface/virtinterfaced.service.in | 24 +
src/libvirt-admin.c | 32 +-
src/libvirt-host.c | 51 +
src/libvirt.c | 42 +-
src/libvirt_internal.h | 1 +
src/libvirt_private.syms | 29 +-
src/libvirt_public.syms | 1 +
src/libvirt_remote.syms | 1 +
src/libxl/Makefile.inc.am | 80 +-
src/libxl/libxl_driver.c | 10 +-
src/libxl/test_libvirtd_libxl.aug.in | 2 +-
src/libxl/virtxend.service.in | 26 +
src/locking/Makefile.inc.am | 77 +-
src/locking/test_libvirt_lockd.aug.in | 2 +-
src/locking/test_libvirt_sanlock.aug.in | 2 +-
src/locking/test_virtlockd.aug.in | 2 +-
src/locking/virtlockd.service.in | 2 +-
src/logging/Makefile.inc.am | 23 +-
src/logging/test_virtlogd.aug.in | 2 +-
src/logging/virtlogd.service.in | 2 +-
src/lxc/Makefile.inc.am | 77 +-
src/lxc/lxc_driver.c | 12 +-
src/lxc/test_libvirtd_lxc.aug.in | 2 +-
src/lxc/virtlxcd.service.in | 40 +
src/network/Makefile.inc.am | 61 +
src/network/bridge_driver.c | 4 +-
src/network/virtnetworkd.service.in | 25 +
src/node_device/Makefile.inc.am | 62 +
src/node_device/node_device_hal.c | 12 +-
src/node_device/node_device_udev.c | 8 +-
src/node_device/virtnodedevd.service.in | 24 +
src/nwfilter/Makefile.inc.am | 62 +
src/nwfilter/nwfilter_driver.c | 12 +-
src/nwfilter/virtnwfilterd.service.in | 24 +
src/qemu/Makefile.inc.am | 76 +-
src/qemu/qemu_driver.c | 8 +-
src/qemu/test_libvirtd_qemu.aug.in | 2 +-
src/qemu/virtqemud.service.in | 40 +
src/remote/Makefile.inc.am | 285 ++--
src/remote/libvirtd-admin.socket.in | 15 +-
src/remote/libvirtd-ro.socket.in | 15 +-
src/remote/libvirtd-tcp.socket.in | 13 +-
src/remote/libvirtd-tls.socket.in | 13 +-
src/remote/{libvirtd.aug => libvirtd.aug.in} | 26 +-
.../{libvirtd.conf => libvirtd.conf.in} | 60 +-
src/remote/libvirtd.service.in | 2 +-
src/remote/libvirtd.socket.in | 11 +-
src/remote/remote_daemon.c | 302 ++--
src/remote/remote_daemon.h | 13 +
src/remote/remote_daemon_config.c | 47 +-
src/remote/remote_daemon_config.h | 10 +-
src/remote/remote_daemon_dispatch.c | 1354 ++++++++++-------
src/remote/remote_driver.c | 424 ++++--
src/remote/remote_driver.h | 4 -
src/remote/remote_protocol.x | 18 +-
src/remote/test_libvirtd.aug.in | 24 +-
src/remote/virtproxyd.service.in | 24 +
src/remote_protocol-structs | 8 +
src/rpc/gendispatch.pl | 96 +-
src/rpc/virnetserverclient.c | 24 +-
src/rpc/virnetserverclient.h | 2 +
src/secret/Makefile.inc.am | 62 +
src/secret/secret_driver.c | 8 +-
src/secret/virtsecretd.service.in | 24 +
src/storage/Makefile.inc.am | 61 +
src/storage/storage_driver.c | 8 +-
src/storage/virtstoraged.service.in | 26 +
src/util/viridentity.c | 483 +++---
src/util/viridentity.h | 87 +-
src/vbox/Makefile.inc.am | 62 +
src/vbox/virtvboxd.service.in | 25 +
src/vz/Makefile.inc.am | 62 +
src/vz/virtvzd.service.in | 25 +
src/vz/vz_driver.c | 14 +-
tests/viridentitytest.c | 97 +-
tests/virnetserverclienttest.c | 45 +-
tools/libvirt-guests.service.in | 2 +-
96 files changed, 3642 insertions(+), 1703 deletions(-)
create mode 100644 src/interface/virtinterfaced.service.in
create mode 100644 src/libxl/virtxend.service.in
create mode 100644 src/lxc/virtlxcd.service.in
create mode 100644 src/network/virtnetworkd.service.in
create mode 100644 src/node_device/virtnodedevd.service.in
create mode 100644 src/nwfilter/virtnwfilterd.service.in
create mode 100644 src/qemu/virtqemud.service.in
rename src/remote/{libvirtd.aug => libvirtd.aug.in} (89%)
rename src/remote/{libvirtd.conf => libvirtd.conf.in} (92%)
create mode 100644 src/remote/virtproxyd.service.in
create mode 100644 src/secret/virtsecretd.service.in
create mode 100644 src/storage/virtstoraged.service.in
create mode 100644 src/vbox/virtvboxd.service.in
create mode 100644 src/vz/virtvzd.service.in
--
2.21.0
5 years, 3 months
[libvirt] [PATCH 00/19] Add vhost-user-gpu support
by marcandre.lureau@redhat.com
From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Hi,
This series of patches adds support for running virtio GPUs in
seperate processes, thanks to vhost-user backend.
The QEMU support landed for 4.1. There are several benefits of running
the GPU/virgl in an external process, since Mesa is rather heavy on
the qemu main loop, and may block for a while, or crash.
The external GPU process is started with one end of a socket pair, the
other end is given to a QEMU chardev attached to a device. The
external process is also added to the cgroup to limit resources usage.
Thanks
Since RFC:
- discover helpers following the vhost-user spec
- change vhost-user <video> model for a vhostuser attribute
- add a patch to specify the rendernode on <accel>
- change the way command line is built, following qemu series changes
- socket labeling
- a few cleanup patches
- rebased
Marc-André Lureau (19):
device-conf: removed unneeded virDomainDeviceInfoCopy()
tpm: minor argument comment fix
qemu_firmware: only set nfeatures on success
qemu: extract out qemuFetchConfigs from firmware
domain: add "vhostuser" attribute to virtio video model
domain: add rendernode attribute on <accel>
qemu-cgroup: allow accel rendernode access
qemu: add vhost-user-gpu capabilities checks
qemu: check that qemu is vhost-user-vga capable
qemu: validate virtio-gpu with vhost-user
qemu: restrict 'virgl=' option to non-vhostuser video type
qemu: add vhost-user helpers
qemu: add qemuSecurityStartVhostUserGPU helper
qemu: add vhost-user-gpu helper unit
qemu: prepare domain for vhost-user GPU
qemu: start/stop the vhost-user-gpu external device
qemu: build vhost-user GPU devices
tests: mock execv/execve
tests: add vhost-user-gpu xml2argv tests
docs/formatdomain.html.in | 11 +
docs/schemas/domaincommon.rng | 16 +-
src/conf/device_conf.c | 22 +-
src/conf/device_conf.h | 4 +-
src/conf/domain_conf.c | 33 +-
src/conf/domain_conf.h | 2 +
src/libvirt_private.syms | 1 -
src/qemu/Makefile.inc.am | 6 +
src/qemu/qemu_capabilities.c | 6 +
src/qemu/qemu_capabilities.h | 4 +
src/qemu/qemu_cgroup.c | 24 ++
src/qemu/qemu_command.c | 54 ++-
src/qemu/qemu_configs.c | 183 ++++++++
src/qemu/qemu_configs.h | 31 ++
src/qemu/qemu_domain.c | 10 +-
src/qemu/qemu_extdevice.c | 79 +++-
src/qemu/qemu_extdevice.h | 5 +
src/qemu/qemu_firmware.c | 146 +------
src/qemu/qemu_process.c | 18 +-
src/qemu/qemu_security.c | 48 +++
src/qemu/qemu_security.h | 6 +
src/qemu/qemu_tpm.c | 2 +-
src/qemu/qemu_vhost_user.c | 395 ++++++++++++++++++
src/qemu/qemu_vhost_user.h | 51 +++
src/qemu/qemu_vhost_user_gpu.c | 307 ++++++++++++++
src/qemu/qemu_vhost_user_gpu.h | 54 +++
tests/Makefile.am | 9 +
.../etc/qemu/vhost-user/40-gpu.json | 1 +
.../etc/qemu/vhost-user/50-gpu.json | 0
.../qemu/vhost-user/test-vhost-user-gpu | 11 +
.../usr/share/qemu/vhost-user/30-gpu.json | 1 +
.../usr/share/qemu/vhost-user/50-gpu.json | 8 +
.../usr/share/qemu/vhost-user/60-gpu.json | 1 +
tests/qemuvhostusertest.c | 132 ++++++
.../vhost-user-gpu-secondary.args | 35 ++
.../vhost-user-gpu-secondary.xml | 44 ++
tests/qemuxml2argvdata/vhost-user-vga.args | 32 ++
tests/qemuxml2argvdata/vhost-user-vga.xml | 41 ++
tests/qemuxml2argvtest.c | 21 +
tests/virfilewrapper.c | 22 +
40 files changed, 1690 insertions(+), 186 deletions(-)
create mode 100644 src/qemu/qemu_configs.c
create mode 100644 src/qemu/qemu_configs.h
create mode 100644 src/qemu/qemu_vhost_user.c
create mode 100644 src/qemu/qemu_vhost_user.h
create mode 100644 src/qemu/qemu_vhost_user_gpu.c
create mode 100644 src/qemu/qemu_vhost_user_gpu.h
create mode 120000 tests/qemuvhostuserdata/etc/qemu/vhost-user/40-gpu.json
create mode 100644 tests/qemuvhostuserdata/etc/qemu/vhost-user/50-gpu.json
create mode 100755 tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-vhost-user-gpu
create mode 120000 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/30-gpu.json
create mode 100644 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/50-gpu.json
create mode 120000 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/60-gpu.json
create mode 100644 tests/qemuvhostusertest.c
create mode 100644 tests/qemuxml2argvdata/vhost-user-gpu-secondary.args
create mode 100644 tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml
create mode 100644 tests/qemuxml2argvdata/vhost-user-vga.args
create mode 100644 tests/qemuxml2argvdata/vhost-user-vga.xml
--
2.22.0.rc2.384.g1a9a72ea1d
5 years, 4 months
[libvirt] [PATCH v1 00/11] Couple of storage driver improvements
by Michal Privoznik
Patches 02/11, 09/11 and finally 11/11 are actual bug fixes. The
rest is a preparation work. More detailed:
02/11 - Fixes a refcounting issue (and thus invalid memory access)
09/11 - Fixes a problem where starting a transitive pool which
has a persistent config may lead to it's disappearance
11/11 - Tries to relax locking to allow more concurrent access
Michal Prívozník (11):
virStoragePoolObjRemove: Don't unlock pool object upon return
virStoragePoolObjListForEach: Grab a reference for pool object
storagePoolRefreshImpl: Fix variable name in comment
virStoragePoolUpdateInactive: Don't call virStoragePoolObjEndAPI
virstorageobj: Rename virStoragePoolObjAssignDef
virStoragePoolObjListAdd: Turn boolean arg into flags
virStoragePoolObjListAdd: Separate out definition assignment
virstorageobj: Introduce VIR_STORAGE_POOL_OBJ_LIST_ADD_LIVE flag
storagePoolCreateXML: Don't lose persistent storage on failed create
storage_driver: Protect pool def during startup and build
storage: Drop and reacquire pool obj lock in some backends
src/conf/virstorageobj.c | 89 ++++++++++++++++++++------
src/conf/virstorageobj.h | 17 ++++-
src/libvirt_private.syms | 4 +-
src/storage/storage_backend_disk.c | 11 +++-
src/storage/storage_backend_fs.c | 13 +++-
src/storage/storage_backend_logical.c | 15 +++--
src/storage/storage_backend_vstorage.c | 9 ++-
src/storage/storage_backend_zfs.c | 7 +-
src/storage/storage_driver.c | 67 +++++++++++--------
src/test/test_driver.c | 21 ++----
10 files changed, 181 insertions(+), 72 deletions(-)
--
2.21.0
5 years, 4 months
[libvirt] RFC: revival of hotplug/unplug for PCI Multifunction devices in QEMU guests
by Daniel Henrique Barboza
Hi,
This is labeled as RFC but it's more like a FYI to let people know and
comment beforehand. Shiva sent a 28 patch series last year that implements
hotplug/unplug support for PCI multifunction devices [1]. The design
motivation of his work was based in a RFC sent to this mailing list back
in 2016 [2].
I'll briefly summarize the goals and motivations here. What we have today
in Libvirt:
- no hotplug/unplug support for multifunction PCI devices
This is explained in details in [2]. When hotplugging a multifunction
device, QEMU will queue the hotplug operation of all non-zero functions and,
when function 0 is hotplugged, all functions are hotplugged together. This
is true for all archs that supports PCI multifunction devices in QEMU. For
unplug it varies: x86 will unplug all functions if any function is
unplugged,
ppc64 needs to unplug each one.
Due to the nature of how Libvirt hotplug works now, hotplug of these devices
is not possible. All hotplugs are considered in an isolated manner. Even if
we hotplug each function in the proper order (i.e. leaving function 0 last),
Libvirt can assign different slots in the guest for each. Similar problems
happens with hot-unplug.
This feature aims to address these by creating a new <devices> element,
exclusive for multifunction devices, that aggregates all functions of a
device
in a single operation. To handle this new element, the existing
attach/detach
functions in the QEMU driver now handles multiple devices.
Attaching/detaching
a single device is routed away from the specialized multifunction code to be
handled to the existing attach/detach code base.
- no support for partial assignment of functions
We can't make the assumption that the guest will always assign all devices
of a multifunction device. Some functions might be a security risk to expose
to a guest, or the device can behave differently depending on the amount
of functions assigned.
Even if the 'leftover' functions can't be used to anything else in the host,
the decision of full/partial assignment of functions should come from the
user, not us. We can't predict how any other hardware vendor will setup
its devices.
This patch series also handles this case.
------
The latest version of this feature, rebase to cdd362e0e7a (the current
master as I'm writing this), can be found at:
https://github.com/danielhb/libvirt/tree/multifunction-rc2
This is a work still ongoing that it's not ready for contribution yet
(first patches that changes the unit test code are breaking existing
tests). The feature itself is being stress tested using a Broadcom BCM5719
with 4 functions and it looks solid. I'll see if I can grab a x86 env
with a multifunction card to test it there too when I have the chance.
Thoughts/comments are welcome. Instead of dropping a 28+ patch set for
review, I'm planning into sending smaller chunks that makes senses
individually.
Thanks,
DHB
[1] https://www.redhat.com/archives/libvir-list/2018-March/msg00729.html
[2] https://www.redhat.com/archives/libvir-list/2016-April/msg01057.html
5 years, 4 months
[libvirt] [PATCH v2 0/9] More consistent virDomainUndefine flag handling
by Eric Blake
Since v1:
- use syntax-check rather than dynamic runtime check for API mismatch
- fix more stragglers with mismatched API, found by the syntax-check
- fix a bug in bhyve no-op flag handling
- expand no-op flag handling to other affected drivers
Eric Blake (9):
vbox: Add various vir*Flags API
xenapi: Add various vir*Flags API
maint: Enhance check-driverimpls.pl to check for API pairing
bhyve: Ignore no-op flag during virDomainUndefine
libxl: Ignore no-op flag during virDomainUndefine
lxc: Ignore no-op flag during virDomainUndefine
openvz: Ignore no-op flag during virDomainUndefine
vmware: Ignore no-op flag during virDomainUndefine
xenapi: Ignore no-op flag during virDomainUndefine
src/bhyve/bhyve_driver.c | 6 +++++-
src/check-driverimpls.pl | 33 +++++++++++++++++++++++++++++++--
src/libxl/libxl_driver.c | 4 +++-
src/lxc/lxc_driver.c | 5 ++++-
src/openvz/openvz_driver.c | 5 ++++-
src/vbox/vbox_common.c | 24 ++++++++++++++++++++++--
src/vmware/vmware_driver.c | 5 ++++-
src/xenapi/xenapi_driver.c | 28 ++++++++++++++++++++++++----
8 files changed, 97 insertions(+), 13 deletions(-)
--
2.20.1
5 years, 4 months
[libvirt] [PATCHv2 00/11] util/resctrl cleanups and refactors
by Wang Huaqiang
Patches submitted for purpose of refactoring existing 'resctrl' related
source code, including some code cleanups as well as some fixes. This is
also a preparation for memory bandwidth monitor codes.
Plan to support Resctrl Control Monitors, which is a feature introduced
by kernel 'resctrl' sub-model. Submit some cleanup and refactoring patches
for upcoming memory bandwidth resource monitoring (MBM) monitors.
Related MBM RFC is
https://www.redhat.com/archives/libvir-list/2019-April/msg01409.html.
This RFC is not actively discussed since libvirt already implemented similar
resctrl cache monitoring (CMT), and lots details have been discussed
and implemented during the work of CMT.
The cleanups and refactoring includes:
v2 changes:
1. Addressed comments of v1.
2. Introduce a new algorithm for verifying new monitor vcpus and existing
monitors and allocations.
3. Fixes for creating default-allocation-monitor in 'resctrl' file
system.(patch 0001).
v1 changes:
1. Removing some reluctant lines and white spaces that is existing
in current code and not meet the libvirt coding style.
2. Replace 'virResctrlAllocIsEmpty' with @n==0 for indicating no
resctrl allocation in configuration file.
3. Private API changes, removed 'virResctrlMonitorGetCacheOccupancy'
and exported a new API named 'virResctrlMonitorGetStats' with similar
functionality, but with capability to be used for retrieving MBM
statistical information.
4. Refactoring 'virResctrlMonitorFreeStats' for more reusing in code.
5. Extend data structure 'virResctrlMonitorStats' with the capability
to carry multiple statistical information from monitor.
Wang Huaqiang (11):
util,conf: Handle default monitor group of an allocation properly
conf: code cleanup, remove empty line and one space
conf: code cleanup for return error code directly
conf: some code cleanup
conf: refactor 'virDomainResctrlVcpuMatch' and some code cleanup
conf: Append 'resctrl' object according to number of monitor group
directly
util: Refactor and rename 'virResctrlMonitorFreeStats'
util: Refactor 'virResctrlMonitorStats'
util: Extend virresctl API to retrieve multiple monitor statistics
util: Remove unused virResctrlMonitorGetCacheOccupancy
conf: Refactor and rename the function to validate a new resctrl
monitor
src/conf/domain_conf.c | 145 ++++++++++++++++++++++++-----------------------
src/libvirt_private.syms | 5 +-
src/qemu/qemu_driver.c | 41 ++++++++++----
src/qemu/qemu_process.c | 3 +-
src/util/virresctrl.c | 75 ++++++++++--------------
src/util/virresctrl.h | 23 +++++---
6 files changed, 156 insertions(+), 136 deletions(-)
--
2.7.4
5 years, 4 months
[libvirt] [PATCH v2 0/7] PCI Multifunction hotplug/unplug, part 1
by Daniel Henrique Barboza
v2:
- rebased without 3 patches from Michal that are under review
in his NVMe patch series
This is the first part of the feature discussed at [1]. These
patches are mostly cleanup and fixes, thus it is beneficial
to have them upstream right away.
The whole feature can be checked out at [2]. All patches survives
unit testing. The feature was stress tested with hundreds
of consecutive hotplug/unplugs of a Broadcom BCM5719 multifunction
network card in a guest running in a Power 8 server. Hopefully
I'll find a suitable x86 env to stress test the feature there
too.
[1] https://www.redhat.com/archives/libvir-list/2019-June/msg00703.html
[2] https://github.com/danielhb/libvirt/tree/multifunction_latest
Daniel Henrique Barboza (1):
util/virhostdev: enhance VFIO device is in use detection
Shivaprasad G Bhat (6):
tests: Fix the iommu group path in mock pci
tests: pci: Mock the iommu groups and vfio
virpcitest: Change the stub driver to vfio from pci-stub
virpcimock: Mock the SRIOV Virtual functions
tests: qemu: Add test case for pci-hostdev hotplug
tests: Add a baseline test for multifunction pci device use case
src/util/virhostdev.c | 74 +++++--
src/util/virprocess.h | 2 +-
tests/Makefile.am | 7 +
tests/qemuhotplugtest.c | 42 +++-
.../qemuhotplug-hostdev-pci.xml | 6 +
.../qemuhotplug-base-live+hostdev-pci.xml | 58 +++++
...uhotplug-pseries-base-live+hostdev-pci.xml | 51 +++++
.../qemuhotplug-pseries-base-live.xml | 43 ++++
.../hostdev-pci-multifunction.args | 35 +++
.../hostdev-pci-multifunction.xml | 59 +++++
.../hostdev-vfio-multidomain.args | 2 +-
.../hostdev-vfio-multidomain.xml | 2 +-
tests/qemuxml2argvdata/hostdev-vfio.args | 2 +-
tests/qemuxml2argvdata/hostdev-vfio.xml | 2 +-
tests/qemuxml2argvdata/net-hostdev-fail.xml | 2 +-
tests/qemuxml2argvdata/net-hostdev-vfio.args | 2 +-
tests/qemuxml2argvdata/net-hostdev-vfio.xml | 2 +-
tests/qemuxml2argvtest.c | 3 +
.../hostdev-pci-multifunction.xml | 79 +++++++
tests/qemuxml2xmloutdata/hostdev-vfio.xml | 2 +-
tests/qemuxml2xmloutdata/net-hostdev-vfio.xml | 2 +-
tests/qemuxml2xmltest.c | 1 +
tests/virhostdevtest.c | 4 +-
tests/virpcimock.c | 201 ++++++++++++++++--
tests/virpcitest.c | 12 +-
tests/virpcitestdata/0000-06-12.0.config | Bin 0 -> 256 bytes
tests/virpcitestdata/0000-06-12.1.config | Bin 0 -> 256 bytes
tests/virpcitestdata/0000-06-12.2.config | Bin 0 -> 256 bytes
tests/virprocessmock.c | 28 +++
29 files changed, 668 insertions(+), 55 deletions(-)
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-hostdev-pci.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-live+hostdev-pci.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live+hostdev-pci.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-multifunction.args
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-multifunction.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-pci-multifunction.xml
create mode 100644 tests/virpcitestdata/0000-06-12.0.config
create mode 100644 tests/virpcitestdata/0000-06-12.1.config
create mode 100644 tests/virpcitestdata/0000-06-12.2.config
create mode 100644 tests/virprocessmock.c
--
2.21.0
5 years, 4 months
[libvirt] [PATCH] util: storage: Fix parsing of 'exportname' from legacy NBD strings
by Peter Krempa
If the nbd export name contains a colon, our parser would not parse it
properly as we split the string by colons. Modify the code to look up
the exportname and copy any trailing characters as the export name is
supposed to be at the end of the string.
https://bugzilla.redhat.com/show_bug.cgi?id=1733044
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/util/virstoragefile.c | 6 ++++--
tests/virstoragetest.c | 8 ++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index a6de6a1e45..ffafeef9d8 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2928,6 +2928,7 @@ virStorageSourceParseNBDColonString(const char *nbdstr,
virStorageSourcePtr src)
{
VIR_AUTOSTRINGLIST backing = NULL;
+ const char *exportname;
if (!(backing = virStringSplit(nbdstr, ":", 0)))
return -1;
@@ -2975,8 +2976,9 @@ virStorageSourceParseNBDColonString(const char *nbdstr,
return -1;
}
- if (backing[3] && STRPREFIX(backing[3], "exportname=")) {
- if (VIR_STRDUP(src->path, backing[3] + strlen("exportname=")) < 0)
+ if ((exportname = strstr(nbdstr, "exportname="))) {
+ exportname += strlen("exportname=");
+ if (VIR_STRDUP(src->path, exportname) < 0)
return -1;
}
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index ef16b3c6e0..f558eea622 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -1262,6 +1262,14 @@ mymain(void)
"<source protocol='nbd' name='blah'>\n"
" <host name='example.org' port='6000'/>\n"
"</source>\n");
+ TEST_BACKING_PARSE("nbd:example.org:6000:exportname=:",
+ "<source protocol='nbd' name=':'>\n"
+ " <host name='example.org' port='6000'/>\n"
+ "</source>\n");
+ TEST_BACKING_PARSE("nbd:example.org:6000:exportname=:test",
+ "<source protocol='nbd' name=':test'>\n"
+ " <host name='example.org' port='6000'/>\n"
+ "</source>\n");
TEST_BACKING_PARSE("nbd://example.org:1234",
"<source protocol='nbd'>\n"
" <host name='example.org' port='1234'/>\n"
--
2.21.0
5 years, 4 months
[libvirt] [PATCH v2]daemon: Fix a crash during virNetlinkEventServiceStopAll
by Liu Haitao
When reboot the host, a core dump file would be generated.
The call traces are:
Note.In this case, the main thread is thread 5.
(gdb) thread 5
[Switching to thread 5 (LWP 4142)]
(gdb) bt
0 0x00007f00a6838273 in futex_wait_cancelable (private=<optimized out>,
expected=0, futex_word=0x7f004c0125c0)
at /usr/src/debug/glibc/2.24-r0/git/sysdeps/unix/sysv/linux/futex-internal.h:88
1 __pthread_cond_wait_common (abstime=0x0, mutex=0x7f004c012540,
cond=0x7f004c012598)
at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_cond_wait.c:502
2 __pthread_cond_wait (cond=0x7f004c012598, mutex=0x7f004c012540)
at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_cond_wait.c:655
3 0x00007f00aa467246 in virCondWait (c=<optimized out>, m=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthread.c:154
4 0x00007f00aa467eb0 in virThreadPoolFree (pool=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthreadpool.c:286
5 0x00007f0074349f9d in qemuStateCleanup ()
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/qemu/qemu_driver.c:1036
6 0x00007f00aa5e9486 in virStateCleanup ()
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/libvirt.c:682
7 0x000055a687ab86a4 in main (argc=<optimized out>, argv=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/remote/remote_daemon.c:1473
(gdb) thread 1
[Switching to thread 1 (LWP 4403)]
(gdb) bt
0 __GI___pthread_mutex_lock (mutex=mutex@entry=0x0)
at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_mutex_lock.c:67
1 0x00007f00aa467165 in virMutexLock (m=m@entry=0x0)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthread.c:89
2 0x00007f00aa43c0f9 in virNetlinkEventServerLock (driver=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virnetlink.c:799
3 virNetlinkEventRemoveClient (watch=watch@entry=0,
macaddr=macaddr@entry=0x7f0088014944, protocol=protocol@entry=0)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virnetlink.c:1197
4 0x00007f00aa4341df in virNetDevMacVLanDeleteWithVPortProfile (
ifname=<optimized out>, macaddr=macaddr@entry=0x7f0088014944,
linkdev=0x7f0088014920 "eth1", mode=mode@entry=1,
virtPortProfile=virtPortProfile@entry=0x0,
stateDir=stateDir@entry=0x7f004c12fa90 "/var/run/libvirt/qemu")
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virnetdevmacvlan.c:1112
5 0x00007f0074312251 in qemuProcessStop (driver=driver@entry=0x7f004c0ecef0,
vm=vm@entry=0x7f0088000b00,
reason=reason@entry=VIR_DOMAIN_SHUTOFF_SHUTDOWN,
asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/qemu/qemu_process.c:7291
6 0x00007f007437a5ea in processMonitorEOFEvent (vm=0x7f0088000b00, driver=0x7f004c0ecef0)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/qemu/qemu_driver.c:4756
7 qemuProcessEventHandler (data=0x55a687d6df10, opaque=0x7f004c0ecef0)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/qemu/qemu_driver.c:4859
8 0x00007f00aa467c5b in virThreadPoolWorker (
opaque=opaque@entry=0x55a687d6c110)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthreadpool.c:163
9 0x00007f00aa466fe8 in virThreadHelper (data=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthread.c:206
10 0x00007f00a68323f4 in start_thread (arg=0x7f00699df700)
at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_create.c:456
11 0x00007f00a616e10f in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105
1. The execution flow of main thread (Thread 5 LWP 4142):
main()
-->virNetDaemonRun()
-->virNetDaemonClose(dmn) //cleanup
-->virNetlinkEventServiceStopAll()
-->virStateCleanup()
-->qemuStateCleanup()
-->virThreadPoolFree()
-->__pthread_cond_wait()
virNetDaemonRun()
-->virEventRunDefaultImpl
-->virEventPollRunOnce
-->virEventPollDispatchHandles
-->qemuMonitorIO
-->qemuProcessHandleMonitorEOF
-->processEvent->eventType = QEMU_PROCESS_EVENT_MONITOR_EOF
-->virThreadPoolSendJob()
After typing reboot command on the host, the main thread would send an event message to another thread.
Here it would let thread 1 to handle the shutdown of qemu process. But it could
not be executed immediately.
virNetlinkEventServiceStopAll()
--> virNetlinkEventServiceStop()
--> server[protocol] = NULL; // set server to null
IN virNetlinkEventServiceStopAll(), some variables related to network are freed,
like (static virNetlinkEventSrvPrivatePtr server).
virStateCleanup()
-->qemuStateCleanup()
-->virThreadPoolFree()
-->__pthread_cond_wait()
In virThreadPoolFree() it will wait other thread to end up.
2. The execution flow of thread 5 (LWP 4403):
qemuProcessStop()
-->virNetDevMacVLanDeleteWithVPortProfile()
-->virNetlinkEventRemoveClient()
--> srv = server[protocol]
Although the main thread had sent the message to thread 1(4403), it could not be
run instantly. It means that the virNetlinkEventServiceStopAll() might be
executed earlier than virNetlinkEventRemoveClient(). We could get it from the log file.
""
2019-06-12 00:10:09.230+0000: 4142: info : virNetlinkEventServiceStopAll:941 : stopping all netlink event services
2019-06-12 00:10:09.230+0000: 4142: info : virNetlinkEventServiceStop:904 : stopping netlink event service
2019-06-12 00:10:21.165+0000: 4403: debug : virNetlinkEventRemoveClient:1190 : removing client watch=0, mac=0x7f0088014944.
"
In virNetlinkEventRemoveClient() the variable server is used again, but now it
is null that is freed by virNetlinkEventServiceStopAll().So it would case a crash .
The virNetlinkEventServiceStopAll() should be executed behind virStateCleanup(),
Signed-off-by: Liu Haitao <haitao.liu(a)windriver.com>
---
src/remote/remote_daemon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index c3782971f1..7da20a6644 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -1464,8 +1464,6 @@ int main(int argc, char **argv) {
/* Keep cleanup order in inverse order of startup */
virNetDaemonClose(dmn);
- virNetlinkEventServiceStopAll();
-
if (driversInitialized) {
/* NB: Possible issue with timing window between driversInitialized
* setting if virNetlinkEventServerStart fails */
@@ -1473,6 +1471,8 @@ int main(int argc, char **argv) {
virStateCleanup();
}
+ virNetlinkEventServiceStopAll();
+
virObjectUnref(adminProgram);
virObjectUnref(srvAdm);
virObjectUnref(qemuProgram);
--
2.21.0
5 years, 4 months