2019-08-15 15:13:06 +02:00
|
|
|
config VHOST
|
|
|
|
bool
|
|
|
|
|
2019-01-23 07:56:00 +01:00
|
|
|
config VIRTIO
|
|
|
|
bool
|
|
|
|
|
|
|
|
config VIRTIO_RNG
|
|
|
|
bool
|
2019-01-23 07:56:15 +01:00
|
|
|
default y
|
|
|
|
depends on VIRTIO
|
2019-01-23 07:56:00 +01:00
|
|
|
|
2020-02-14 14:27:36 +01:00
|
|
|
config VIRTIO_IOMMU
|
|
|
|
bool
|
|
|
|
default y
|
2020-03-20 11:41:24 +01:00
|
|
|
depends on PCI && VIRTIO
|
2020-02-14 14:27:36 +01:00
|
|
|
|
2019-01-23 07:56:00 +01:00
|
|
|
config VIRTIO_PCI
|
|
|
|
bool
|
2019-01-23 07:56:04 +01:00
|
|
|
default y if PCI_DEVICES
|
|
|
|
depends on PCI
|
|
|
|
select VIRTIO
|
2019-01-23 07:56:00 +01:00
|
|
|
|
|
|
|
config VIRTIO_MMIO
|
|
|
|
bool
|
2019-01-23 07:56:15 +01:00
|
|
|
select VIRTIO
|
2019-01-23 07:56:00 +01:00
|
|
|
|
2019-01-29 10:42:14 +01:00
|
|
|
config VIRTIO_CCW
|
|
|
|
bool
|
|
|
|
select VIRTIO
|
|
|
|
|
2019-01-23 07:56:00 +01:00
|
|
|
config VIRTIO_BALLOON
|
|
|
|
bool
|
2019-01-23 07:56:15 +01:00
|
|
|
default y
|
|
|
|
depends on VIRTIO
|
2019-01-23 07:56:00 +01:00
|
|
|
|
|
|
|
config VIRTIO_CRYPTO
|
|
|
|
bool
|
2019-01-23 07:56:15 +01:00
|
|
|
default y
|
|
|
|
depends on VIRTIO
|
2019-06-19 11:49:01 +02:00
|
|
|
|
|
|
|
config VIRTIO_PMEM_SUPPORTED
|
|
|
|
bool
|
|
|
|
|
|
|
|
config VIRTIO_PMEM
|
|
|
|
bool
|
|
|
|
default y
|
|
|
|
depends on VIRTIO
|
|
|
|
depends on VIRTIO_PMEM_SUPPORTED
|
|
|
|
select MEM_DEVICE
|
virtio-mem: Paravirtualized memory hot(un)plug
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".
--------------------------------------------------------------------------
There are two important follow-up items that are in the works:
1. Resizeable memory regions: Use resizeable allocations/RAM blocks to
grow/shrink along with the usable region size. This avoids creating
initially very big VMAs, RAM blocks, and KVM slots.
2. Protection of unplugged memory: Make sure the gust cannot actually
make use of unplugged memory.
Other follow-up items that are in the works:
1. Exclude unplugged memory during migration (via precopy notifier).
2. Handle remapping of memory.
3. Support for other architectures.
--------------------------------------------------------------------------
Example usage (virtio-mem-pci is introduced in follow-up patches):
Start QEMU with two virtio-mem devices (one per NUMA node):
$ qemu-system-x86_64 -m 4G,maxmem=20G \
-smp sockets=2,cores=2 \
-numa node,nodeid=0,cpus=0-1 -numa node,nodeid=1,cpus=2-3 \
[...]
-object memory-backend-ram,id=mem0,size=8G \
-device virtio-mem-pci,id=vm0,memdev=mem0,node=0,requested-size=0M \
-object memory-backend-ram,id=mem1,size=8G \
-device virtio-mem-pci,id=vm1,memdev=mem1,node=1,requested-size=1G
Query the configuration:
(qemu) info memory-devices
Memory device [virtio-mem]: "vm0"
memaddr: 0x140000000
node: 0
requested-size: 0
size: 0
max-size: 8589934592
block-size: 2097152
memdev: /objects/mem0
Memory device [virtio-mem]: "vm1"
memaddr: 0x340000000
node: 1
requested-size: 1073741824
size: 1073741824
max-size: 8589934592
block-size: 2097152
memdev: /objects/mem1
Add some memory to node 0:
(qemu) qom-set vm0 requested-size 500M
Remove some memory from node 1:
(qemu) qom-set vm1 requested-size 200M
Query the configuration again:
(qemu) info memory-devices
Memory device [virtio-mem]: "vm0"
memaddr: 0x140000000
node: 0
requested-size: 524288000
size: 524288000
max-size: 8589934592
block-size: 2097152
memdev: /objects/mem0
Memory device [virtio-mem]: "vm1"
memaddr: 0x340000000
node: 1
requested-size: 209715200
size: 209715200
max-size: 8589934592
block-size: 2097152
memdev: /objects/mem1
[1] https://lkml.kernel.org/r/20200311171422.10484-1-david@redhat.com
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200626072248.78761-11-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2020-06-26 09:22:37 +02:00
|
|
|
|
|
|
|
config VIRTIO_MEM_SUPPORTED
|
|
|
|
bool
|
|
|
|
|
|
|
|
config VIRTIO_MEM
|
|
|
|
bool
|
|
|
|
default y
|
|
|
|
depends on VIRTIO
|
|
|
|
depends on LINUX
|
|
|
|
depends on VIRTIO_MEM_SUPPORTED
|
|
|
|
select MEM_DEVICE
|