libvirt/docs/schemas
Michal Privoznik f931cb7f21 conf: Introduce virtio-mem <memory/> model
The virtio-mem is paravirtualized mechanism of adding/removing
memory to/from a VM. A virtio-mem-pci device is split into blocks
of equal size which are then exposed (all or only a requested
portion of them) to the guest kernel to use as regular memory.
Therefore, the device has two important attributes:

  1) block-size, which defines the size of a block
  2) requested-size, which defines how much memory (in bytes)
     is the device requested to expose to the guest.

The 'block-size' is configured on command line and immutable
throughout device's lifetime. The 'requested-size' can be set on
the command line too, but also is adjustable via monitor. In
fact, that is how management software places its requests to
change the memory allocation. If it wants to give more memory to
the guest it changes 'requested-size' to a bigger value, and if it
wants to shrink guest memory it changes the 'requested-size' to a
smaller value. Note, value of zero means that guest should
release all memory offered by the device. Of course, guest has to
cooperate. Therefore, there is a third attribute 'size' which is
read only and reflects how much memory the guest still has. This
can be different to 'requested-size', obviously. Because of name
clash, I've named it 'current' and it is dealt with in future
commits (it is a runtime information anyway).

In the backend, memory for virtio-mem is backed by usual objects:
memory-backend-{ram,file,memfd} and their size puts the cap on
the amount of memory that a virtio-mem device can offer to a
guest. But we are already able to express this info using <size/>
under <target/>.

Therefore, we need only two more elements to cover 'block-size'
and 'requested-size' attributes. This is the XML I've came up
with:

  <memory model='virtio-mem'>
    <source>
      <nodemask>1-3</nodemask>
      <pagesize unit='KiB'>2048</pagesize>
    </source>
    <target>
      <size unit='KiB'>2097152</size>
      <node>0</node>
      <block unit='KiB'>2048</block>
      <requested unit='KiB'>1048576</requested>
    </target>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
  </memory>

I hope by now it is obvious that:

  1) 'requested-size' must be an integer multiple of
     'block-size', and
  2) virtio-mem-pci device goes onto PCI bus and thus needs PCI
     address.

Then there is a limitation that the minimal 'block-size' is
transparent huge page size (I'll leave this without explanation).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-01 11:02:53 +02:00
..
basictypes.rng schema: Add define for object names 2021-01-08 09:18:21 +01:00
capability.rng whitespace clean-ups 2021-07-15 14:50:48 +02:00
cpu.rng schema: Add schema for guest or host cpu definition 2020-10-07 09:18:07 +02:00
cputypes.rng schemas: Allow cache attribute for bandwidth element for HMAT 2021-07-08 16:28:30 +02:00
domain.rng schema: Unify apostrophe and quotation mark usage 2020-10-07 09:18:07 +02:00
domainbackup.rng schema: Unify apostrophe and quotation mark usage 2020-10-07 09:18:07 +02:00
domaincaps.rng conf: Add availability of s390-pv in domain capabilities 2021-07-21 13:30:30 +02:00
domaincheckpoint.rng schema: Unify apostrophe and quotation mark usage 2020-10-07 09:18:07 +02:00
domaincommon.rng conf: Introduce virtio-mem <memory/> model 2021-10-01 11:02:53 +02:00
domainsnapshot.rng conf: snapshot: Add support for <metadata_cache> 2021-01-08 15:27:00 +01:00
interface.rng schema: Unify apostrophe and quotation mark usage 2020-10-07 09:18:07 +02:00
meson.build schema: Add schema for guest or host cpu definition 2020-10-07 09:18:07 +02:00
network.rng schema: Unify apostrophe and quotation mark usage 2020-10-07 09:18:07 +02:00
networkcommon.rng schema: Unify apostrophe and quotation mark usage 2020-10-07 09:18:07 +02:00
networkport.rng schema: Unify apostrophe and quotation mark usage 2020-10-07 09:18:07 +02:00
nodedev.rng schemas: Allow <unique_id/> to be zero 2021-09-21 14:12:34 +02:00
nwfilter_params.rng schemas: add schema for nwfilter binding XML document 2018-06-26 11:22:07 +01:00
nwfilter.rng schema: nwfiter: Allow leading/trailing whitespace in 'variable-name-type' 2020-10-20 09:05:10 +02:00
nwfilterbinding.rng schema: Unify apostrophe and quotation mark usage 2020-10-07 09:18:07 +02:00
secret.rng schema: secret: Relax requirements for usage name 2021-01-08 09:18:21 +01:00
storagecommon.rng storage: add support for QCOW2 cluster_size option 2021-05-21 14:00:43 +02:00
storagepool.rng schema: Add define for object names 2021-01-08 09:18:21 +01:00
storagepoolcaps.rng schema: Unify apostrophe and quotation mark usage 2020-10-07 09:18:07 +02:00
storagevol.rng storage: add support for QCOW2 cluster_size option 2021-05-21 14:00:43 +02:00