Re: [PATCH v1 10/17] virtio-mem: Paravirtualized memory hot(un)plug

Eric Blake
2020-05-06T16:12:56Z

On 5/6/20 4:49 AM, David Hildenbrand wrote:
> This is the very basic/initial version of virtio-mem. An introduction to
> virtio-mem can be found in the Linux kernel driver [1]. While it can be
> used in the current state for hotplug of a smaller amount of memory, it
> will heavily benefit from resizeable memory regions in the future.
>
> Each virtio-mem device manages a memory region (provided via a memory
> backend). After requested by the hypervisor ("requested-size"), the
> guest can try to plug/unplug blocks of memory within that region, in order
> to reach the requested size. Initially, and after a reboot, all memory is
> unplugged (except in special cases - reboot during postcopy).
>
> The guest may only try to plug/unplug blocks of memory within the usable
> region size. The usable region size is a little bigger than the
> requested size, to give the device driver some flexibility. The usable
> region size will only grow, except on reboots or when all memory is
> requested to get unplugged. The guest can never plug more memory than
> requested. Unplugged memory will get zapped/discarded, similar to in a
> balloon device.
>
> The block size is variable, however, it is always chosen in a way such that
> THP splits are avoided (e.g., 2MB). The state of each block
> (plugged/unplugged) is tracked in a bitmap.
>
> As virtio-mem devices (e.g., virtio-mem-pci) will be memory devices, we now
> expose "VirtioMEMDeviceInfo" via "query-memory-devices".
>

> +++ b/qapi/misc.json
> @@ -1354,19 +1354,56 @@
> }
> }
>
> +##
> +# @VirtioMEMDeviceInfo:
> +#

> +# @memdev: memory backend linked with the region
> +#
> +# Since: 5.1

Here you claim 5.1,

> +##
> +{ 'struct': 'VirtioMEMDeviceInfo',
> + 'data': { '*id': 'str',
> + 'memaddr': 'size',
> + 'requested-size': 'size',
> + 'size': 'size',
> + 'max-size': 'size',
> + 'block-size': 'size',
> + 'node': 'int',
> + 'memdev': 'str'
> + }
> +}
> +
> ##
> # @MemoryDeviceInfo:
> #
> # Union containing information about a memory device
> #
> # nvdimm is included since 2.12. virtio-pmem is included since 4.1.
> +# virtio-mem is included since 5.2.

but here 5.2. They should probably be the same :)

--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org