On 1/10/24 12:59, Peter Krempa wrote:
On Fri, Jan 05, 2024 at 13:33:32 +0100, Michal Privoznik wrote:
> Introduced in v8.2.0-rc0~74^2~2, QEMU now allows setting
> .dynamic-memslots attribute for virtio-mem-pci devices. When
> turned on, it allows memory exposed to guest to be split into
> multiple memslots and thus smaller memory footprint (see the
> original commit for detailed explanation).
>
> Therefore, introduce new <target/> attribute which will control
> that QEMU knob.
>
> Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
> ---
> docs/formatdomain.rst | 6 ++++++
> src/conf/domain_conf.c | 18 +++++++++++++++++-
> src/conf/domain_conf.h | 1 +
> src/conf/schemas/domaincommon.rng | 5 +++++
> .../memory-hotplug-virtio-mem.xml | 2 +-
> 5 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
> index 96e03a3807..57974de9f4 100644
> --- a/docs/formatdomain.rst
> +++ b/docs/formatdomain.rst
> @@ -8395,6 +8395,12 @@ Example: usage of the memory devices
> The ``node`` subelement configures the guest NUMA node to attach the memory
> to. The element shall be used only if the guest has NUMA nodes configured.
>
> + For ``virtio-mem`` optional attribute ``dynamicMemslots`` can be specified
> + (accepted values "yes"/"no") which allows hypervisor to
spread memory into
> + multiple memory slots (allocate them dynamically based on the amount of
> + memory exposed to the guest), resulting in smaller memory footprint.
> + :since:`Since 10.0.0 and QEMU 8.2.0`
> +
Except for the docs here, which are insufficient as outlined in the
other subthread, the code looks good, so for the code:
How about this:
For ``virtio-mem`` optional attribute ``dynamicMemslots`` can be specified
(accepted values "yes"/"no") which allows hypervisor to spread
memory into
multiple memory slots (allocate them dynamically based on the amount of
memory exposed to the guest), resulting in smaller memory footprint. But be
aware this may affect vhost-user devices. When enabled, older vhost-user
devices may refuse to initialize resulting in failed domain startup or
device hotplug (set this to "no" then). On the other hand, modern vhost-user
devices, or when no vhost-user devices are present (nor they will be
hotplugged), this leads to smaller memory footprint (set this to "yes"
then). The current default is hypervisor dependant (for QEMU is "no"). If
the default changes and you are having difficulties with vhost-user devices,
try toggling this to "no". :since:`Since 10.1.0 and QEMU 8.2.0`
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
Thank you!
Michal