]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agotests: qemuxml2xml: Convert os-firmware* to TEST_CAPS
Cole Robinson [Mon, 15 Apr 2019 22:51:11 +0000 (18:51 -0400)]
tests: qemuxml2xml: Convert os-firmware* to TEST_CAPS

Convert these test cases to use DO_TEST_CAPS_LATEST

* os-firmware-bios
* os-firmware-efi
* os-firmware-efi-secboot

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2xml: Convert virtio-*transitional to TEST_CAPS
Cole Robinson [Mon, 15 Apr 2019 22:46:44 +0000 (18:46 -0400)]
tests: qemuxml2xml: Convert virtio-*transitional to TEST_CAPS

Convert these test cases to use DO_TEST_CAPS_LATEST

* virtio-transitional
* virtio-non-transitional

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2xml: Add DO_TEST_CAPS*
Cole Robinson [Mon, 15 Apr 2019 22:43:32 +0000 (18:43 -0400)]
tests: qemuxml2xml: Add DO_TEST_CAPS*

Add DO_TEST_CAPS* macros, lifted from qemuxml2argvtest.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: qemuxml2xml: Set name in testQemuInfo
Cole Robinson [Mon, 15 Apr 2019 22:19:19 +0000 (18:19 -0400)]
tests: qemuxml2xml: Set name in testQemuInfo

Use the same pattern that is used in qemuxml2argvtest, setting the
name in a static testQemuInfo instance inside the test macros

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agonetwork: use virNetDevTapReattachBridge API
Daniel P. Berrangé [Fri, 1 Feb 2019 13:46:33 +0000 (13:46 +0000)]
network: use virNetDevTapReattachBridge API

Switch over to use the new API for re-attaching the bridge device

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: add helper method for re-attaching a tap device to a bridge
Daniel P. Berrangé [Fri, 1 Feb 2019 12:39:25 +0000 (12:39 +0000)]
util: add helper method for re-attaching a tap device to a bridge

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonetwork: add missing bandwidth limits for bridge forward type
Daniel P. Berrangé [Tue, 20 Nov 2018 11:30:05 +0000 (11:30 +0000)]
network: add missing bandwidth limits for bridge forward type

In the case of a network with forward=bridge, which has a bridge device
listed, we are capable of setting bandwidth limits but fail to call the
function to register them.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoconf: simplify link from hostdev back to network device
Daniel P. Berrangé [Thu, 26 Jul 2018 16:24:30 +0000 (17:24 +0100)]
conf: simplify link from hostdev back to network device

hostdevs have a link back to the original network device. This is fairly
generic accepting any type of device, however, we don't intend to make
use of this approach in future. It can thus be specialized to network
devices.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonetwork: drop back compat code loading actual bridge name
Daniel P. Berrangé [Tue, 2 Apr 2019 17:18:40 +0000 (18:18 +0100)]
network: drop back compat code loading actual bridge name

The actual network def was updated to save the bridge name back
in 1.2.11:

  commit a3609121799d44898a3e0d0bf92b755e55e7b418
  Author: Laine Stump <laine@laine.org>
  Date:   Fri Nov 21 12:20:37 2014 -0500

    network: save bridge name in ActualNetDef when actualType==network too

The chance that someone is running libvirt < 1.2.11 and wants
todo a live upgrade to 5.3.0 without a host reboot is essentially
zero. We can thus reasonably drop the back compat code now.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonetwork: pass a virNetworkPtr to port management APIs
Daniel P. Berrangé [Thu, 26 Jul 2018 14:32:04 +0000 (15:32 +0100)]
network: pass a virNetworkPtr to port management APIs

The APIs for allocating/notifying/removing network ports just take
an internal domain interface struct right now. As a step towards
turning these into public facing APIs, add a virNetworkPtr argument
to all of them.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonetwork: restrict usage of port management APIs
Daniel P. Berrangé [Thu, 26 Jul 2018 10:37:32 +0000 (11:37 +0100)]
network: restrict usage of port management APIs

The port allocation APIs are currently called unconditionally for all
types of NIC, but (mostly) only do anything for NICs with type=network.

The exception is the port allocate API which does some validation even
for NICs with type!=network. Relying on this validation is flawed,
however, since the network driver may not even be installed. IOW virt
drivers must not delegate validation to the network driver for NICs
with type != network.

This change allows us to report errors when the virtual network driver
is not registered.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agodocs: Add emulatorsched support to news.xml
Martin Kletzander [Mon, 15 Apr 2019 12:41:44 +0000 (14:41 +0200)]
docs: Add emulatorsched support to news.xml

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Add support for emulatorsched
Martin Kletzander [Mon, 15 Apr 2019 11:13:06 +0000 (13:13 +0200)]
qemu: Add support for emulatorsched

This helps in a scenarios where vCPUs run with a priority that is so high they
might starve the emulator thread.  And it also fits with the rest of the
settings.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Add support for emulatorsched
Martin Kletzander [Mon, 15 Apr 2019 08:45:38 +0000 (10:45 +0200)]
conf: Add support for emulatorsched

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agodocs: Mention iothreadsched element in the docs and reword
Martin Kletzander [Mon, 15 Apr 2019 11:17:41 +0000 (13:17 +0200)]
docs: Mention iothreadsched element in the docs and reword

Just one missing occurrence of iothreadsched fixed plus some rewording for this
to make more sense for the readers.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Format thread IDs optionally
Martin Kletzander [Mon, 15 Apr 2019 08:48:07 +0000 (10:48 +0200)]
conf: Format thread IDs optionally

This will be used later when we want to format emulator scheduler parameters
which don't apply for multiple threads.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Parse common scheduler attributes in separate function
Martin Kletzander [Mon, 15 Apr 2019 08:56:03 +0000 (10:56 +0200)]
conf: Parse common scheduler attributes in separate function

This will become useful later when parsing emulatorsched parameters which don't
need the rest of the current function.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: do not set wait:false for client sockets
Marc-André Lureau [Mon, 15 Apr 2019 16:51:48 +0000 (18:51 +0200)]
qemu: do not set wait:false for client sockets

Qemu commit 767abe7 ("chardev: forbid 'wait' option with client
sockets") effectively deprecates usage of "wait" with client sockets
starting with qemu 4.0, and earlier versions ignored the value.

Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agonews: cleanup in virNetTLSContextNew
Adrian Brzezinski [Mon, 15 Apr 2019 18:29:43 +0000 (20:29 +0200)]
news: cleanup in virNetTLSContextNew

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Adrian Brzezinski <redhat@adrb.pl>
6 years agorpc: cleanup in virNetTLSContextNew
Adrian Brzezinski [Mon, 15 Apr 2019 18:29:42 +0000 (20:29 +0200)]
rpc: cleanup in virNetTLSContextNew

Failed new gnutls context allocations in virNetTLSContextNew function
results in double free and segfault. Occasional memory leaks may also
occur.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Adrian Brzezinski <redhat@adrb.pl>
6 years agonews: Document firmware autoselection exposure in domcaps
Michal Privoznik [Wed, 10 Apr 2019 12:31:33 +0000 (14:31 +0200)]
news: Document firmware autoselection exposure in domcaps

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
6 years agovirSecurityDACRestoreChardevLabel: Restore UNIX sockets too
Michal Privoznik [Mon, 15 Apr 2019 15:16:39 +0000 (17:16 +0200)]
virSecurityDACRestoreChardevLabel: Restore UNIX sockets too

We're setting seclabels on unix sockets but never restoring them.
Surprisingly, we are doing so in SELinux driver.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agodocs: document firmware attribute for VMware guests
Pino Toscano [Tue, 9 Apr 2019 14:04:33 +0000 (16:04 +0200)]
docs: document firmware attribute for VMware guests

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
6 years agovmx: write firmware back from autoselection
Pino Toscano [Tue, 9 Apr 2019 14:04:32 +0000 (16:04 +0200)]
vmx: write firmware back from autoselection

When writing the VMX file from the domain XML, write the firmware key
according to the firmware autoselection.  Though, at the moment only
'efi' is supported.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
6 years agovmx: convert firmware config for autoselection
Pino Toscano [Tue, 9 Apr 2019 14:04:31 +0000 (16:04 +0200)]
vmx: convert firmware config for autoselection

Convert the firmware key to a type of autoselected firmware.

Only the 'efi' firmware is allowed for now, in case the key is present.
It seems VMware (at least ESXi) does not write the key in VMX files when
setting BIOS as firmware.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
6 years agonetwork: only reload firewall after firewalld is finished restarting
Laine Stump [Fri, 12 Apr 2019 15:23:02 +0000 (11:23 -0400)]
network: only reload firewall after firewalld is finished restarting

The network driver used to reload the firewall rules whenever a dbus
NameOwnerChanged message for org.fedoraproject.FirewallD1 was
received. Presumably at some point in the past this was successful at
reloading our rules after a firewalld restart. Recently though I
noticed that once firewalld was restarted, libvirt's logs would get this
message:

  The name org.fedoraproject.FirewallD1 was not provided by any .service files

After this point, no networks could be started until libvirtd itself
was restarted.

The problem is that the NameOwnerChanged message is sent twice during
a firewalld restart - once when the old firewalld is stopped, and
again when the new firewalld is started. If we try to reload at the
point the old firewalld is stopped, none of the firewalld dbus calls
will succeed.

The solution is to check the new_owner field of the message - we
should reload our firewall rules only if new_owner is non-empty (it is
set to "" when firewalld is stopped, and some sort of epoch number
when it is again started).

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: eliminate duplicate function virDBusMessageRead
Laine Stump [Fri, 12 Apr 2019 16:58:01 +0000 (12:58 -0400)]
util: eliminate duplicate function virDBusMessageRead

When virDBusMessageRead() and virDBusMessageDecode were first added in
commit 834c9c94, they were identical except that virDBusMessageRead()
would unref the message after decoding it.

This difference was eliminated later in commit dc7f3ffc after it
became apparent that unref-ing the message so soon was never the right
thing to do. The two identical functions remained though, with the
tests and virDBus library itself calling the Decode variant, and all
other users calling the Read variant.

This patch eliminates the duplication, switching all users to
virDBusMessageDecode (and moving the nice API documentation comment
from the Read function up to the Decode function).

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovbox: drop C API definition for release 4.3.4
Daniel P. Berrangé [Fri, 12 Apr 2019 10:54:26 +0000 (11:54 +0100)]
vbox: drop C API definition for release 4.3.4

Support for compiling this version was dropped in an earlier commit.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovbox: drop C API definition for release 4.3
Daniel P. Berrangé [Fri, 12 Apr 2019 10:54:26 +0000 (11:54 +0100)]
vbox: drop C API definition for release 4.3

Support for compiling this version was dropped in an earlier commit.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovbox: drop C API definition for release 4.2.20
Daniel P. Berrangé [Fri, 12 Apr 2019 10:54:26 +0000 (11:54 +0100)]
vbox: drop C API definition for release 4.2.20

Support for compiling this version was dropped in an earlier commit.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovbox: drop C API definition for release 4.2
Daniel P. Berrangé [Fri, 12 Apr 2019 10:54:26 +0000 (11:54 +0100)]
vbox: drop C API definition for release 4.2

Support for compiling this version was dropped in an earlier commit.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovbox: drop C API definition for release 4.1
Daniel P. Berrangé [Fri, 12 Apr 2019 10:54:26 +0000 (11:54 +0100)]
vbox: drop C API definition for release 4.1

Support for compiling this version was dropped in an earlier commit.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovbox: drop C API definition for release 4.0
Daniel P. Berrangé [Fri, 12 Apr 2019 10:54:26 +0000 (11:54 +0100)]
vbox: drop C API definition for release 4.0

Support for compiling this version was dropped in an earlier commit.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovbox: drop support for VirtualBox 4.x releases
Daniel P. Berrangé [Fri, 12 Apr 2019 10:51:09 +0000 (11:51 +0100)]
vbox: drop support for VirtualBox 4.x releases

Support for all the 4.x releases was ended by VirtualBox maintainers in
Dec 2015. Even the "newest" 4.3.40 of those is only supported on old
versions of Linux (Ubuntu <= 13.03, RHEL <= 6, SLES <= 11), which are all
discontinued hosts from libvirt's POV.

We can thus reasonably drop all 4.x support from the libvirt VirtualBox
driver.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonetwork: clear cached error if we successfully create firewall chains
Daniel P. Berrangé [Fri, 12 Apr 2019 15:53:50 +0000 (16:53 +0100)]
network: clear cached error if we successfully create firewall chains

Since:

  commit 9f4e35dc73ec9e940aa61bc7c140c2b800218ef3
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Mon Mar 18 17:31:21 2019 +0000

    network: improve error report when firewall chain creation fails

We cache an error when failing to create the top level firewall chains.
This commit failed to account for fact that we may invoke
networkPreReloadFirewallRules() many times while libvirtd is running.
For example when firewalld is restarted.

When this happens the original failure may no longer occurr and we'll
successfully create our top level chains. We failed to clear the cached
error resulting in us failing to start virtual networks.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agotools: Reduce table width in virsh(1)
Andrea Bolognani [Fri, 12 Apr 2019 11:37:21 +0000 (13:37 +0200)]
tools: Reduce table width in virsh(1)

The table included in the sample output for 'list --title' is
unnecessarily wide, which causes man to complain:

  warning [p 8, 0.5i]: can't break line

Make the table narrower.

Spotted by Lintian (manpage-has-errors-from-man tag).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
6 years agotools: Fix grammar
Andrea Bolognani [Fri, 12 Apr 2019 11:16:20 +0000 (13:16 +0200)]
tools: Fix grammar

Apparently "allow(s) to frobnicate" is not correct English, and
either "allow(s) one to frobnicate" or "allow(s) frobnicating"
should be used instead.

Spotted by Lintian (spelling-error-in-{binary,manpage} tags).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
6 years agoutil: Fix NAME section for virkey{code,name}-*
Andrea Bolognani [Mon, 15 Apr 2019 13:10:06 +0000 (15:10 +0200)]
util: Fix NAME section for virkey{code,name}-*

Spotted by Lintian (manpage-has-bad-whatis-entry tag).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
6 years agokeycodemapdb: Update submodule
Andrea Bolognani [Mon, 15 Apr 2019 12:48:26 +0000 (14:48 +0200)]
keycodemapdb: Update submodule

We need commit 6280c94f306d in order to fix our generated
man pages.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
6 years agoDon't hardcode list of git submodules
Andrea Bolognani [Mon, 15 Apr 2019 12:43:44 +0000 (14:43 +0200)]
Don't hardcode list of git submodules

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: Don't cache microcode version
Jiri Denemark [Fri, 12 Apr 2019 19:21:05 +0000 (21:21 +0200)]
qemu: Don't cache microcode version

My earlier commit be46f61326 was incomplete. It removed caching of
microcode version in the CPU driver, which means the capabilities XML
will see the correct microcode version. But it is also cached in the
QEMU capabilities cache where it is used to detect whether we need to
reprobe QEMU. By missing the second place, the original commit
be46f61326 made the situation even worse since libvirt would report
correct microcode version while still using the old host CPU model
(visible in domain capabilities XML).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoDelete QEMU_CAPS_KQEMU and QEMU_CAPS_ENABLE_KQEMU
Ján Tomko [Wed, 3 Apr 2019 07:13:21 +0000 (09:13 +0200)]
Delete QEMU_CAPS_KQEMU and QEMU_CAPS_ENABLE_KQEMU

Support for kqemu was dropped in libvirt by commit 8e91a400c and even
back then we never set these capabilities when doing QMP probing.

Since no QEMU we aim to support has these, drop them completely.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoexamples: Initialize @pos in domtop.c
Martin Kletzander [Mon, 15 Apr 2019 09:19:31 +0000 (11:19 +0200)]
examples: Initialize @pos in domtop.c

This is a zero-cost workaround for a bug in GCC 8.3.0 which causes the
compilation to fail, because the compiler thinks that the value might be used
uninitialized even though it clearly cannot be.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
6 years agoFix spelling for macOS
Andrea Bolognani [Tue, 2 Apr 2019 09:04:46 +0000 (11:04 +0200)]
Fix spelling for macOS

Though it used to be called "Mac OS X" and "OS X" in the past,
it was never "MacOS X" nor "OS-X", and it's just "macOS" now.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agonews: Drop empty sections
Andrea Bolognani [Mon, 1 Apr 2019 09:53:16 +0000 (11:53 +0200)]
news: Drop empty sections

We have occasionally failed to document certain categories
of changes in the release notes, yet still left the
corresponding sections in the file even though they were
completely empty.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agocpu_x86: Fix placement of *CheckFeature functions
Michal Privoznik [Sun, 14 Apr 2019 19:44:01 +0000 (21:44 +0200)]
cpu_x86: Fix placement of *CheckFeature functions

In e17d10386 these functions were mistakenly moved into an #ifdef
block, but remained used outside of it leaving the build broken
for platforms where #ifdef evaluated to false.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agovirhostcpu: Make virHostCPUGetMSR() work only on x86
Michal Privoznik [Sat, 13 Apr 2019 20:38:55 +0000 (22:38 +0200)]
virhostcpu: Make virHostCPUGetMSR() work only on x86

Model specific registers are a thing only on x86. Also, the
/dev/cpu/0/msr path exists only on Linux and the fallback
mechanism (asking KVM) exists on Linux and FreeBSD only.

Therefore, move the function within #ifdef that checks all
aforementioned constraints and provide a dummy stub for all
other cases.

This fixes the build on my arm box, mingw-* builds, etc.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agovirhostcpu.c: Fix misalignment in virHostCPUGetMSRFromKVM comment
Michal Privoznik [Sat, 13 Apr 2019 20:34:16 +0000 (22:34 +0200)]
virhostcpu.c: Fix misalignment in virHostCPUGetMSRFromKVM comment

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoPPC64 support for NVIDIA V100 GPU with NVLink2 passthrough
Daniel Henrique Barboza [Thu, 4 Apr 2019 13:40:39 +0000 (10:40 -0300)]
PPC64 support for NVIDIA V100 GPU with NVLink2 passthrough

The NVIDIA V100 GPU has an onboard RAM that is mapped into the
host memory and accessible as normal RAM via an NVLink2 bridge. When
passed through in a guest, QEMU puts the NVIDIA RAM window in a
non-contiguous area, above the PCI MMIO area that starts at 32TiB.
This means that the NVIDIA RAM window starts at 64TiB and go all the
way to 128TiB.

This means that the guest might request a 64-bit window, for each PCI
Host Bridge, that goes all the way to 128TiB. However, the NVIDIA RAM
window isn't counted as regular RAM, thus this window is considered
only for the allocation of the Translation and Control Entry (TCE).
For more information about how NVLink2 support works in QEMU,
refer to the accepted implementation [1].

This memory layout differs from the existing VFIO case, requiring its
own formula. This patch changes the PPC64 code of
@qemuDomainGetMemLockLimitBytes to:

- detect if we have a NVLink2 bridge being passed through to the
guest. This is done by using the @ppc64VFIODeviceIsNV2Bridge function
added in the previous patch. The existence of the NVLink2 bridge in
the guest means that we are dealing with the NVLink2 memory layout;

- if an IBM NVLink2 bridge exists, passthroughLimit is calculated in a
different way to account for the extra memory the TCE table can alloc.
The 64TiB..128TiB window is more than enough to fit all possible
GPUs, thus the memLimit is the same regardless of passing through 1 or
multiple V100 GPUs.

Further reading explaining the background
[1] https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg03700.html
[2] https://www.redhat.com/archives/libvir-list/2019-March/msg00660.html
[3] https://www.redhat.com/archives/libvir-list/2019-April/msg00527.html

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu_domain: NVLink2 bridge detection function for PPC64
Daniel Henrique Barboza [Thu, 4 Apr 2019 13:40:38 +0000 (10:40 -0300)]
qemu_domain: NVLink2 bridge detection function for PPC64

The NVLink2 support in QEMU implements the detection of NVLink2
capable devices by verifying the attributes of the VFIO mem region
QEMU allocates for the NVIDIA GPUs. To properly allocate an
adequate amount of memLock, Libvirt needs this information before
a QEMU instance is even created, thus querying QEMU is not
possible and opening a VFIO window is too much.

An alternative is presented in this patch. Making the following
assumptions:

- if we want GPU RAM to be available in the guest, an NVLink2 bridge
must be passed through;

- an unknown PCI device can be classified as a NVLink2 bridge
if its device tree node has 'ibm,gpu', 'ibm,nvlink',
'ibm,nvlink-speed' and 'memory-region'.

This patch introduces a helper called @ppc64VFIODeviceIsNV2Bridge
that checks the device tree node of a given PCI device and
check if it meets the criteria to be a NVLink2 bridge. This
new function will be used in a follow-up patch that, using the
first assumption, will set up the rlimits of the guest
accordingly.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
6 years agocpu_map: Distribute x86_Cascadelake-Server.xml
Michal Privoznik [Sat, 13 Apr 2019 19:33:22 +0000 (21:33 +0200)]
cpu_map: Distribute x86_Cascadelake-Server.xml

In 2878278c74cc4 we've added new cpu model but we've forgot to
distribute the XML file it comes in.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Label uniqDir when probing capabilities
Martin Kletzander [Fri, 12 Apr 2019 13:22:48 +0000 (15:22 +0200)]
qemu: Label uniqDir when probing capabilities

This does not cause a problem in usual scenarios thanks to us allowing
CAP_DAC_OVERRIDE for the qemu process, however in some scenarios this might be
an issue because the directory is created with mkdtemp(3) which explicitly
creates that with 0700 permissions and qemu running as non-root cannot access
that.

The scenarios include:
 - Builds without CAPNG
 - Running libvirtd in certain container configurations [1]
 - and possibly others.

[1] https://github.com/kubevirt/kubevirt/pull/2181#issuecomment-481840304

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovircpuhost: Add support for reading MSRs
Jiri Denemark [Fri, 22 Mar 2019 15:44:02 +0000 (16:44 +0100)]
vircpuhost: Add support for reading MSRs

The new virHostCPUGetMSR internal API will try to read the MSR from
/dev/cpu/0/msr and if it is not possible (the device does not exist or
libvirt is running unprivileged), it will fallback to asking KVM for the
MSR using KVM_GET_MSRS ioctl.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Add support for MSR features to cpu-cpuid.py
Jiri Denemark [Mon, 1 Apr 2019 16:24:05 +0000 (18:24 +0200)]
cputest: Add support for MSR features to cpu-cpuid.py

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Add support for MSR features to cpu-parse.sh
Jiri Denemark [Tue, 26 Mar 2019 20:20:38 +0000 (21:20 +0100)]
cputest: Add support for MSR features to cpu-parse.sh

The script just parses whatever cpu-gather.sh printed out.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Add support for MSR features to cpu-gather.sh
Jiri Denemark [Tue, 26 Mar 2019 09:18:10 +0000 (10:18 +0100)]
cputest: Add support for MSR features to cpu-gather.sh

This patch adds an inline python code for reading MSR features. Since
reading MSRs is a privileged operation, we have to read them from
/dev/cpu/*/msr if it is readable (i.e., the script runs as root) or
fallback to using KVM ioctl which can be done by any user that can start
virtual machines.

The python code is inlined rather than provided in a separate script
because whenever there's an issue with proper detection of CPU features,
we ask the reporter to run cpu-gather.sh script to give us all data we
need to know about the host CPU. Asking them to run several scripts
would likely result in one of them being ignored or forgotten.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Generalize feature parsing in cpu-cpuid.py
Jiri Denemark [Tue, 2 Apr 2019 17:13:18 +0000 (19:13 +0200)]
cputest: Generalize feature parsing in cpu-cpuid.py

The parseMapFeature for parsing features from CPU map XML can be easily
generalized to support more feature types.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Prepare cpu-cpuid.py for MSR features
Jiri Denemark [Tue, 2 Apr 2019 17:02:04 +0000 (19:02 +0200)]
cputest: Prepare cpu-cpuid.py for MSR features

Let's make sure the current CPUID specific code is only applied to CPUID
features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Rename in_e[ac]x as e[ac]x_in in cpu-cpuid.py
Jiri Denemark [Mon, 1 Apr 2019 17:23:01 +0000 (19:23 +0200)]
cputest: Rename in_e[ac]x as e[ac]x_in in cpu-cpuid.py

This will let us simplify the code since the dictionary keys will match
attribute names in various XMLs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Fix comparison in checkCPUIDFeature in cpu-cpuid.py
Jiri Denemark [Mon, 1 Apr 2019 16:26:38 +0000 (18:26 +0200)]
cputest: Fix comparison in checkCPUIDFeature in cpu-cpuid.py

leaf["eax"] & eax > 0 check works correctly only if there's at most 1
bit set in eax. Luckily that's been always the case, but fixing this
could save us from future surprises.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Generalize function names in cpu-cpuid.py
Jiri Denemark [Mon, 1 Apr 2019 15:06:59 +0000 (17:06 +0200)]
cputest: Generalize function names in cpu-cpuid.py

The function will have to deal with both CPUID and MSR features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Drop support for old QEMU from cpu-parse.sh
Jiri Denemark [Mon, 1 Apr 2019 11:19:16 +0000 (13:19 +0200)]
cputest: Drop support for old QEMU from cpu-parse.sh

We don't really need to parse CPU data from QEMU older than 2.9 (i.e.,
before query-cpu-model-expansion) at this point. But even if there's a
need to do so, we can always use an older version of this script to do
the conversion.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Move *CheckFeature functions
Jiri Denemark [Fri, 22 Mar 2019 15:44:21 +0000 (16:44 +0100)]
cpu_x86: Move *CheckFeature functions

They are static and we will need to call them a little bit closer to the
beginning of the file.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Add support for storing MSR features in CPU map
Jiri Denemark [Tue, 19 Mar 2019 08:45:48 +0000 (09:45 +0100)]
cpu_x86: Add support for storing MSR features in CPU map

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Store virCPUx86DataItem content in union
Jiri Denemark [Thu, 14 Mar 2019 14:44:27 +0000 (15:44 +0100)]
cpu_x86: Store virCPUx86DataItem content in union

The structure can only be used for CPUID data now. Adding a type
indicator and moving the data into a union will let us store alternative
data types.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Make x86cpuidMatch more general
Jiri Denemark [Fri, 15 Mar 2019 18:57:59 +0000 (19:57 +0100)]
cpu_x86: Make x86cpuidMatch more general

The function now works on virCPUx86DataItem and it's called
virCPUx86DataItemMatch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Make x86cpuidMatchMasked more general
Jiri Denemark [Fri, 15 Mar 2019 18:50:00 +0000 (19:50 +0100)]
cpu_x86: Make x86cpuidMatchMasked more general

The function is renamed as virCPUx86DataItemMatchMasked to reflect the
change in parameter types.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Make x86cpuidAndBits more general
Jiri Denemark [Fri, 15 Mar 2019 18:44:18 +0000 (19:44 +0100)]
cpu_x86: Make x86cpuidAndBits more general

The function now works on virCPUx86DataItem and it's renamed as
virCPUx86DataItemAndBits.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Make x86cpuidClearBits more general
Jiri Denemark [Fri, 15 Mar 2019 18:01:27 +0000 (19:01 +0100)]
cpu_x86: Make x86cpuidClearBits more general

The parameters changed from virCPUx86CPUID to virCPUx86DataItem and the
function is now called virCPUx86DataItemClearBits.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Make x86cpuidSetBits more general
Jiri Denemark [Fri, 15 Mar 2019 17:52:47 +0000 (18:52 +0100)]
cpu_x86: Make x86cpuidSetBits more general

The function is renamed as virCPUx86DataItemSetBits and it works on
virCPUx86DataItem now.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Introduce virCPUx86DataCmp
Jiri Denemark [Fri, 15 Mar 2019 17:36:58 +0000 (18:36 +0100)]
cpu_x86: Introduce virCPUx86DataCmp

virCPUx86DataSorter already compares two virCPUx86DataItem structs.
Let's add a tiny wrapper around it called virCPUx86DataCmp and use it
instead of open coded comparisons.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Simplify x86DataAdd
Jiri Denemark [Fri, 15 Mar 2019 15:37:28 +0000 (16:37 +0100)]
cpu_x86: Simplify x86DataAdd

The while loop just copied half of virCPUx86DataAddItem.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Rename virCPUx86VendorToCPUID
Jiri Denemark [Thu, 14 Mar 2019 21:30:52 +0000 (22:30 +0100)]
cpu_x86: Rename virCPUx86VendorToCPUID

Renamed as virCPUx86VendorToData.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Rename virCPUx86DataAddCPUID
Jiri Denemark [Thu, 14 Mar 2019 21:02:44 +0000 (22:02 +0100)]
cpu_x86: Rename virCPUx86DataAddCPUID

It's called virCPUx86DataAdd now.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Rename virCPUx86DataAddCPUIDInt
Jiri Denemark [Thu, 14 Mar 2019 20:59:49 +0000 (21:59 +0100)]
cpu_x86: Rename virCPUx86DataAddCPUIDInt

The new name is virCPUx86DataAddItem.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Rename virCPUx86CPUIDSorter
Jiri Denemark [Thu, 14 Mar 2019 20:57:41 +0000 (21:57 +0100)]
cpu_x86: Rename virCPUx86CPUIDSorter

It is called virCPUx86DataSorter since the function will work on any CPU
data type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Rename x86DataCpuid
Jiri Denemark [Thu, 14 Mar 2019 20:52:04 +0000 (21:52 +0100)]
cpu_x86: Rename x86DataCpuid

It is now called virCPUx86DataGet.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Rename x86DataCpuidNext function
Jiri Denemark [Thu, 14 Mar 2019 20:50:59 +0000 (21:50 +0100)]
cpu_x86: Rename x86DataCpuidNext function

The function is now called virCPUx86DataNext to reflect its purpose: it
is an iterator over CPU data (both CPUID and MSR in the near future).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Rename virCPUx86DataItem variables
Jiri Denemark [Thu, 14 Mar 2019 20:32:27 +0000 (21:32 +0100)]
cpu_x86: Rename virCPUx86DataItem variables

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Rename virCPUx86Vendor.cpuid
Jiri Denemark [Wed, 13 Mar 2019 16:04:15 +0000 (17:04 +0100)]
cpu_x86: Rename virCPUx86Vendor.cpuid

Although vendor string is always reported by CPUID, the container struct
is used for consistency and thus "cpuid" name is not a good fit anymore.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_x86: Introduce virCPUx86DataItem container struct
Jiri Denemark [Wed, 13 Mar 2019 16:01:19 +0000 (17:01 +0100)]
cpu_x86: Introduce virCPUx86DataItem container struct

The following patches introduce CPU features read from MSR in addition
to those queried via CPUID instruction. Let's introduce a container
struct which will be able to describe either feature type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu_map: Add Cascadelake-Server CPU model
Jiri Denemark [Mon, 11 Mar 2019 15:39:25 +0000 (16:39 +0100)]
cpu_map: Add Cascadelake-Server CPU model

Introduced in QEMU 3.1.0 by commit
c7a88b52f62b30c04158eeb07f73e3f72221b6a8

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocputest: Add data for Intel(R) Xeon(R) Platinum 8268 CPU
Jiri Denemark [Tue, 19 Mar 2019 11:33:31 +0000 (12:33 +0100)]
cputest: Add data for Intel(R) Xeon(R) Platinum 8268 CPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomaint: Add filetype annotations to Makefile.inc.am
Andrea Bolognani [Fri, 12 Apr 2019 12:41:10 +0000 (14:41 +0200)]
maint: Add filetype annotations to Makefile.inc.am

Vim has trouble figuring out the filetype automatically because
the name doesn't follow existing conventions; annotations like
the ones we already have in Makefile.ci help it out.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agom4: readline: Add gross kludge for include path
Andrea Bolognani [Tue, 9 Apr 2019 11:48:47 +0000 (13:48 +0200)]
m4: readline: Add gross kludge for include path

Unfortunately the data reported by pkg-config is not completely
accurate, so until the issue has been fixed in readline we need
to work around it in libvirt.

The good news is that we only need the fix to land in FreeBSD
ports and macOS homebrew before we can drop the kludge, so
we're talking months rather than years.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agom4: readline: Use pkg-config where possible
Andrea Bolognani [Tue, 2 Apr 2019 10:32:11 +0000 (12:32 +0200)]
m4: readline: Use pkg-config where possible

With the 7.0 release, readline has finally started shipping
pkg-config support in the form of a readline.pc file.

Unfortunately, most downstreams have yet to catch up with this
change: among Linux distributions in particular, Fedora Rawhide
seems to be the only one installing it at the moment.

Non-Linux operating systems have been faring much better in
this regard: both FreeBSD (through ports) and macOS (through
homebrew) include pkg-config support in their readline package.

This is great news for us, since those are the platforms where
pkg-config is more useful on account of them installing headers
and libraries outside of the respective default search paths.

Our implementation checks whether readline is registered as a
pkg-config package, and if so obtains CFLAGS and LIBS using the
tool; if not, we just keep using the existing logic.

This commit is best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agom4: readline: Drop extra_LIBS machinery
Andrea Bolognani [Tue, 9 Apr 2019 13:49:22 +0000 (15:49 +0200)]
m4: readline: Drop extra_LIBS machinery

The first implementation of this logic was introduced with
commit 2ec759fc58fe all the way back in 2007; looking at the
build logs from our CI environment, however, it's apparent
that none of the platforms we currently target are actually
using it, so we can assume whatever issue it was working
around has been fixed at some point in the last 12 years.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agom4: readline: Extract code setting -D_FUNCTION_DEF
Andrea Bolognani [Mon, 8 Apr 2019 14:39:57 +0000 (16:39 +0200)]
m4: readline: Extract code setting -D_FUNCTION_DEF

The current code is a bit awkward, and we're going to need
to share it later anyway. We can drop the call to AC_SUBST()
while we're at it, since LIBVIRT_CHECK_LIB() already marks
READLINE_CFLAGS for substitution.

The new code goes to some extra length to avoid setting
-D_FUNCTION_DEF twice: this is mostly for cosmetic reasons,
and it's necessary because LIBVIRT_CHECK_READLINE() is called
twice: once on its own, and then once more as part of
LIBVIRT_CHECK_BASH_COMPLETION().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agom4: readline: Comment rl_completion_quote_character() check
Andrea Bolognani [Tue, 9 Apr 2019 13:56:54 +0000 (15:56 +0200)]
m4: readline: Comment rl_completion_quote_character() check

The check was added in 74416b1d4849 without offering any
explanation outside of the commit message. Introduce a comment
to make digging through the git history unnecessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agom4: readline: Fix indentation
Andrea Bolognani [Tue, 9 Apr 2019 13:38:23 +0000 (15:38 +0200)]
m4: readline: Fix indentation

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agotools: vsh: Drop obsolete readline compatibility code
Andrea Bolognani [Tue, 2 Apr 2019 09:51:19 +0000 (11:51 +0200)]
tools: vsh: Drop obsolete readline compatibility code

This code is needed to use readline older than 4.1, but all
our target platforms ship with at least 6.0 these days so we
can safely get rid of it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agolib: Don't use virReportSystemError() if virCommandRun() fails
Michal Privoznik [Mon, 1 Apr 2019 12:56:23 +0000 (14:56 +0200)]
lib: Don't use virReportSystemError() if virCommandRun() fails

Firstly, virCommandRun() does report an error on failure (which
in most cases is more accurate than what we overwrite it with).
Secondly, usually errno is not set (or gets overwritten in the
cleanup code) which makes virReportSystemError() report useless
error messages. Drop all virReportSystemError() calls in cases
like this (I've found three occurrences).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoconf: Fix typo enconding -> encoding
Andrea Bolognani [Fri, 12 Apr 2019 11:04:15 +0000 (13:04 +0200)]
conf: Fix typo enconding -> encoding

Introduced-by: e0fae78ad550
Spotted-by: Lintian
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu_command: Prefer '-overcommit mem-lock' over -realtime mlock'
Michal Privoznik [Fri, 12 Apr 2019 08:25:40 +0000 (10:25 +0200)]
qemu_command: Prefer '-overcommit mem-lock' over -realtime mlock'

The latter is deprecated and will be removed soon. The advised
replacement is '-overcommit mem-lock=on|off'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu_capabilities: Introduce QEMU_CAPS_OVERCOMMIT
Michal Privoznik [Fri, 12 Apr 2019 08:16:06 +0000 (10:16 +0200)]
qemu_capabilities: Introduce QEMU_CAPS_OVERCOMMIT

Added in QEMU commit of v3.0.0-rc0~48^2~9 (then fixed by
v3.1.0-rc0~119^2~37) QEMU is replacing '-realtime mlock' with
'-overcommit mem-lock'. Add a capability to tell if we're dealing
new new enough qemu to use the replacement.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Always assume QEMU_CAPS_REALTIME_MLOCK
Michal Privoznik [Fri, 12 Apr 2019 08:03:36 +0000 (10:03 +0200)]
qemu: Always assume QEMU_CAPS_REALTIME_MLOCK

The '-realtime mlock' cmd line argument was introduced in QEMU
commit v1.5.0-rc0~190 which matches minimal QEMU version we
require. Therefore, the capability will always be present.

Apparently, nearly none of our xml2argv test cases had the
capability hence slightly bigger change under qemuxml2argvdata/.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuxml2argvtest: remove old mlock tests
Ján Tomko [Fri, 12 Apr 2019 09:54:26 +0000 (11:54 +0200)]
qemuxml2argvtest: remove old mlock tests

Now that we test with real QEMU data, remove the tests which enumerated
the capabilities.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuxml2argvtest: add mlock tests for latest QEMU
Ján Tomko [Fri, 12 Apr 2019 08:01:53 +0000 (10:01 +0200)]
qemuxml2argvtest: add mlock tests for latest QEMU

Test the memory locking command line with different QEMU versions
to prepare for changing it for latest QEMU.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuxml2argvtest: add mlock tests for QEMU 3.0.0
Ján Tomko [Fri, 12 Apr 2019 08:00:41 +0000 (10:00 +0200)]
qemuxml2argvtest: add mlock tests for QEMU 3.0.0

Test the memory locking command line with different QEMU versions
to prepare for changing it for latest QEMU.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirresctrl: fix MBA memory leak
Pavel Hrdina [Thu, 11 Apr 2019 15:13:16 +0000 (17:13 +0200)]
virresctrl: fix MBA memory leak

The 'bandwidths' variable is allocated using VIR_RESIZE_N so it has to
be freed as well.

==118315== 8 bytes in 1 blocks are definitely lost in loss record 299 of 2,401
==118315==    at 0x4C29DAD: malloc (vg_replace_malloc.c:308)
==118315==    by 0x4C2C100: realloc (vg_replace_malloc.c:836)
==118315==    by 0x52C3FAF: virReallocN (viralloc.c:245)
==118315==    by 0x52C4079: virExpandN (viralloc.c:294)
==118315==    by 0x532BBA8: virResctrlAllocParseProcessMemoryBandwidth (virresctrl.c:1156)
==118315==    by 0x532BBA8: virResctrlAllocParseMemoryBandwidthLine (virresctrl.c:1211)
==118315==    by 0x532BBA8: virResctrlAllocParse (virresctrl.c:1414)
==118315==    by 0x532BBA8: virResctrlAllocGetGroup (virresctrl.c:1446)
==118315==    by 0x532C11D: virResctrlAllocGetDefault (virresctrl.c:1464)
==118315==    by 0x532D15E: virResctrlAllocAssign (virresctrl.c:1923)
==118315==    by 0x532D15E: virResctrlAllocCreate (virresctrl.c:2042)
==118315==    by 0x31E1ABEE: qemuProcessResctrlCreate (qemu_process.c:2596)
==118315==    by 0x31E1ABEE: qemuProcessLaunch (qemu_process.c:6444)
==118315==    by 0x31E1E341: qemuProcessStart (qemu_process.c:6721)
==118315==    by 0x31E81315: qemuDomainObjStart.constprop.50 (qemu_driver.c:7288)
==118315==    by 0x31E81A65: qemuDomainCreateWithFlags (qemu_driver.c:7341)
==118315==    by 0x54DDB4B: virDomainCreate (libvirt-domain.c:6534)

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>