Commit Graph

39642 Commits

Author SHA1 Message Date
Michal Privoznik
e0a09c243c hyperv: Make it obvious that hypervAddEmbeddedParam() consumes an argument
Upon successful return hypervAddEmbeddedParam() transfers
ownership of @table argument to @params. But because it takes
only simple pointer (which hides this ownership transfer) it
doesn't clear the @table pointer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
2020-10-19 11:13:10 +02:00
Michal Privoznik
49562e92e8 hyperv: Drop needless label in hypervDomainSetMemoryFlags()
Now, that hypervInvokeMethod() clears the passed pointer we don't
need a special cleanup label ('params_cleanup') that handles
non-obvious ownership transfer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
2020-10-19 11:13:10 +02:00
Michal Privoznik
0dbfb9c5a6 hyperv: Reindent hypervInvokeMethod() body
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
2020-10-19 11:13:10 +02:00
Michal Privoznik
f978e2e6ef hyperv: Make it obvious that hypervInvokeMethod() consumes an argument
Upon invocation, hypervInvokeMethod() consumes passed @params
(the second argument) regardless whether success or failure is
released. However, it takes only simple pointer (which hides this
ownership transfer) and because of that it doesn't clear it.

Switch to double pointer and tweak the documentation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
2020-10-19 11:13:10 +02:00
Erik Skultety
2508d10f67 conf: domain: sev: Make 'cbitpos' & 'reducedPhysBits' attrs optional
These XML attributes have been mandatory since the introduction of SEV
support to libvirt. This design decision was based on QEMU's
requirement for these to be mandatory for migration purposes, as
differences in these values across platforms must result in the
pre-migration checks failing (not that migration with SEV works at the
time of this patch).

Expecting the user to specify these is cumbersome and the same XML
cannot be re-used across different revisions of SEV. Since
we have SEV platform information saved in QEMU capabilities, we can
make the attributes optional and should fill them in automatically
in the QEMU driver right before starting it.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/57

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-19 11:03:39 +02:00
Erik Skultety
ccb40cf288 qemu: process: sev: Fill missing 'cbitpos' & 'reducedPhysBits' from caps
These XML attributes have been mandatory since the introduction of SEV
support to libvirt. This design decision was based on QEMU's
requirement for these to be mandatory for migration purposes, as
differences in these values across platforms must result in the
pre-migration checks failing (not that migration with SEV works at the
time of this patch).

This patch enables autofill of these attributes right before launching
QEMU and thus updating the live XML.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-19 11:03:27 +02:00
Erik Skultety
1fdc907325 qemu: process: Move SEV capability check to qemuValidateDomainDef
Checks such as this one should be done at domain def validation time,
not before starting the QEMU process.
As for this change, existing domains will see some QEMU error when
starting as opposed to a libvirt error that this QEMU binary doesn't
support SEV, but that's okay, we never guaranteed error messages to
remain the same.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-19 11:03:16 +02:00
Erik Skultety
649f720a9a qemu_process: sev: Drop an unused variable
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-19 11:01:56 +02:00
Michal Privoznik
da20178709 docs: Document camelCase preference for XML elements and attributes
Recently I've merged a patch that used hyphens in an attribute
name. I fixed it later, but turned out we don't document our
preference which is camelCase.

Suggested-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-19 10:18:27 +02:00
Daniel Henrique Barboza
6a0e0dc7ba qemu_validate.c: move secure boot checks to qemuValidateDomainDefBoot()
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
6533b8664e qemu_validate.c: move VCPU topology checks to qemuValidateDomainCpuCount()
Rename the function to qemuValidateDomainVCpuTopology() to reflect
what it is currently doing as well.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
e06c8d6dfd qemu_validate.c: move NUMA HMAT check to qemuValidateDomainDefNuma()
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
27371bd517 qemu_command.c: move QEMU_CAPS_DEVICE_NVDIMM_UNARMED check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
0bf8dfb02a qemu_command.c: move 'panic' validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
d3dad77dd6 qemu_command.c: move usb_redir validations to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
eb42c1313f qemu_command.c: move SHMEM validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
c47b013992 qemu_command.c: move NUMA memory backing check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
4b42c27ee7 qemu_command.c: move CPU mode check to qemu_validate.c
All but VIR_CPU_MODE_HOST_MODEL were moved. 'host_model' mode
has nuances that forbid the verification to be moved to parse
time.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:33 -03:00
Daniel Henrique Barboza
2d8a60fab1 qemu_command.c: move QEMU_CAPS_FW_CFG validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:54:27 -03:00
Daniel Henrique Barboza
f800aa3ee7 qemu_command.c: move RNG backend validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
66f15d17e2 qemu_command.c: move QEMU_CAPS_DEVICE_VHOST_SCSI check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
03e4e4b21e qemu_command.c: move QEMU_CAPS_DEVICE_USB_KBD check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
31ac666454 qemu_command.c: reduce qemuBuildNicDevStr() if clauses
We have a lot of "if (usingVirtio)" checks being done while
constructing the NIC command line. Let's put all of them in
a single "if".

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
edee4290c9 qemu_command.c: move QEMU_CAPS_VIRTIO_NET_HOST_MTU check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
53fa517082 qemu_command.c: move QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:34 -03:00
Daniel Henrique Barboza
78c6507473 qemu_command.c: move QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:50:26 -03:00
Daniel Henrique Barboza
37c6d4a62c qemu_command.c: move QEMU_CAPS_VIRTIO_TX_ALG check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:01:49 -03:00
Daniel Henrique Barboza
a40659eb82 qemu_command.c: move DISK_BUS_USB validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:01:49 -03:00
Daniel Henrique Barboza
216e4b1c45 qemu_command.c: move DISK_BUS_VIRTIO validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 10:01:36 -03:00
Daniel Henrique Barboza
da1748cab1 qemu_command.c: move DISK_BUS_SATA validation to qemu_validate.c
A few tweaks were made during the move:

- the error messages were changed to mention 'sata controller'
instead of 'ide controller';

- a check for address type 'drive' was added like it is done
with other bus types. The error message of qemuxml2argdata was
updated to reflect that now, instead of erroring it out from the
common code in virDomainDiskDefValidate(), we're failing earlier
with a different error message.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 09:55:37 -03:00
Daniel Henrique Barboza
cd97692000 qemu_command.c: move LSILOGIC controller validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 09:55:27 -03:00
Daniel Henrique Barboza
c9fbb07bab qemu_command.c: move LUN and IDE checks to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 09:45:34 -03:00
Daniel Henrique Barboza
ccb08c3818 qemu_command.c: move wwn validation to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 09:45:17 -03:00
Tim Wiederhake
4bd0633211 docs: Expand on recommendation in hypervisor-cpu-baseline description
On some architectures, e.g. aarch64 and s390x, the output of
`virsh capabilities` is not suitable for use in
`virsh hypervisor-cpu-baseline`. Expand the description of the
man page to make this explicit.

https://bugzilla.redhat.com/show_bug.cgi?id=1850654

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-15 11:39:17 +02:00
Michal Privoznik
0c5bb37f76 docs: Clarify free_page_reporting attribute
The 'reporting' suffix of the attribute makes it sound like we
could be reporting something to user. While in fact, this is
purely virtio membaloon <-> QEMU business. Clarify the docs to
make it clear.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-15 10:57:33 +02:00
Michal Privoznik
76db9e8bcd lib: s/free-page-reporting/freePageReporting/
In fee8a61d29 a new attribute to <memballoon/> was introduced:
free-page-reporting. We don't really like hyphens in attribute
names. Use camelCase instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-15 10:57:11 +02:00
Michal Privoznik
9ba99180b3 tests: Turn virtio-options-memballoon-freepage-reporting.xml into a symlink
The output virtio-options-memballoon-freepage-reporting.xml of
xml2xmlout is the same as the input. Make it as symlink to save
space.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-15 10:51:07 +02:00
Jiri Denemark
cb6c2fa4ed docs: Mention GPG key used for signing releases
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-14 17:33:27 +02:00
Pino Toscano
2214fe9044 vmx: start parsing SATA disks
Always reverse-engineering VMX files, attempt to support SATA disks in
guests, and their controllers.

The esx-in-the-wild-10 test case is taken from RHBZ#1883588, while the
result of esx-in-the-wild-8 is updated with SATA disks.

Fixes (hopefully):
https://bugzilla.redhat.com/show_bug.cgi?id=1677608
https://bugzilla.redhat.com/show_bug.cgi?id=1883588

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-14 11:23:30 +02:00
Pino Toscano
18a1dd57cd vmx: expand the disk array
Account for the possible SATA disks too, which means 120 potential
disks.

This means the size of the array triples, however that is unavoidable
with the current way of reading disks.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-14 11:23:27 +02:00
Pino Toscano
11e61489ff vmx: shortcut 'cdrom-image' as CD-ROM earlier
Add it to the list of 'deviceType' values ignored for disks.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-14 11:23:24 +02:00
Pino Toscano
b23ee6394a vmx: hide private helpers
Move all the private helpers for parsing and formatting of domain
elements as private static functions in vmx.c, to avoid using them
directly.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-14 11:23:18 +02:00
Jonathon Jongsma
b0d9efd7f2 qemu: remove some unnecessary local variables
These variables seem to be left over from a previous refactoring and
they don't add anything to the code.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2020-10-14 00:24:45 -04:00
Halil Pasic
5d787acbf0 Reflect in virtiofs.rst that virtiofs can be used without NUMA
Reflect in the virtiofs documentation that virtiofs can now be used
even without NUMA. While at it, be more precise where and why shared
memory is required.

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-13 19:04:47 +02:00
Marc Hartmayer
e2425a1727 qemu: virtiofs can be used without NUMA nodes
...if a machine memory-backend using shared memory is configured for
the guest. This is especially important for QEMU machine types that
don't have NUMA but virtiofs support.

An example snippet:

  <domain type='kvm'>
    <name>test</name>
    <memory unit='KiB'>2097152</memory>
    <memoryBacking>
      <access mode='shared'/>
    </memoryBacking>
    <devices>
	<filesystem type='mount' accessmode='passthrough'>
	<driver type='virtiofs'/>
	<source dir='/tmp/test'/>
	<target dir='coffee'/>
      </filesystem>
      ...
    </devices>
    ...
  </domain>

and the corresponding QEMU command line:

  /usr/bin/qemu-system-s390x \
  -machine s390-ccw-virtio-5.2,memory-backend=s390.ram \
  -m 2048 \
  -object
  memory-backend-file,id=s390.ram,mem-path=/var/lib/libvirt/qemu/ram/46-test/s390.ram,share=yes,size=2147483648 \
  ...

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-13 19:03:45 +02:00
Nico Pache
4cb5f34905 provide testing for free-page-reporting feature in QEMU
This provides basic testing for the free-page-reporting feature that is
introduced in qemu 5.1.

Signed-off-by: Nico Pache <npache@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-13 17:02:48 +02:00
Nico Pache
021fea29c3 QEMU: introduce Virtio free page reporting feature
This patch enables the free-page-reporting in qemu.

Signed-off-by: Nico Pache <npache@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-13 17:02:45 +02:00
Nico Pache
5032b247e9 QEMU: declare qemu capabilities for the Virtio Free page reporting feature
This patch will introduce the free-page-reporting feature capabilities
that are in qemu 5.1

Signed-off-by: Nico Pache <npache@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-13 17:02:42 +02:00
Nico Pache
fee8a61d29 Document and parser support for the Virtio free page reporting feature.
This will add the proper documentation and parser support for the free page
reporting feature that is introduced in QEMU 5.1.

Signed-off-by: Nico Pache <npache@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-13 17:01:38 +02:00
Michal Privoznik
0b66196d86 qemu: Set noqueue qdisc for TAP devices
By default, pfifo_fast queueing discipline (qdisc) is set on
newly created interfaces (including TAPs). This qdisc has three
queues and packets that want to be sent through given NIC are
placed into one of the queues based on TOS field. Queues are then
emptied based on their priority allowing interactive sessions
stay interactive whilst something else is downloading a large
file.

Obviously, this means that kernel has to be involved and some
locking has to happen (when placing packets into queues). If
virtualization is taken into account then the above algorithm
happens twice - once in the guest and the second time in the
host.

This is arguably not optimal as it burns host CPU cycles
needlessly. Guest already made it choice and sent packets in the
order it wants.

To resolve this, Linux kernel offers 'noqueue' qdisc which can be
applied on virtual interfaces and in fact for 'lo' it is by
default:

  lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue

Set it for other TAP devices we create for domains too. With this
change I was able to squeeze 1Mbps more from a macvtap attached
to a guest and to my 1Gbps LAN (as measured by iperf3).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1329644
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-10-13 16:31:29 +02:00