2016-10-24 12:13:49 +03:00
|
|
|
ifeq ($(CONFIG_VIRTIO),y)
|
2013-04-19 12:45:25 +04:00
|
|
|
common-obj-y += virtio-bus.o
|
2018-05-22 22:48:22 +03:00
|
|
|
obj-y += virtio.o
|
|
|
|
|
2019-08-15 16:13:06 +03:00
|
|
|
obj-$(CONFIG_VHOST) += vhost.o vhost-backend.o
|
|
|
|
common-obj-$(call lnot,$(CONFIG_VHOST)) += vhost-stub.o
|
2019-02-14 20:35:50 +03:00
|
|
|
obj-$(CONFIG_VHOST_USER) += vhost-user.o
|
|
|
|
|
2018-05-22 22:48:22 +03:00
|
|
|
common-obj-$(CONFIG_VIRTIO_RNG) += virtio-rng.o
|
|
|
|
common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
|
|
|
|
common-obj-$(CONFIG_VIRTIO_MMIO) += virtio-mmio.o
|
|
|
|
obj-$(CONFIG_VIRTIO_BALLOON) += virtio-balloon.o
|
|
|
|
obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-crypto.o
|
2019-09-30 13:51:34 +03:00
|
|
|
obj-$(CONFIG_VHOST_USER_FS) += vhost-user-fs.o
|
2018-05-22 22:48:22 +03:00
|
|
|
obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) += virtio-crypto-pci.o
|
2019-06-19 12:49:01 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_PMEM) += virtio-pmem.o
|
2019-06-19 12:49:04 +03:00
|
|
|
common-obj-$(call land,$(CONFIG_VIRTIO_PMEM),$(CONFIG_VIRTIO_PCI)) += virtio-pmem-pci.o
|
2019-09-30 13:51:35 +03:00
|
|
|
obj-$(call land,$(CONFIG_VHOST_USER_FS),$(CONFIG_VIRTIO_PCI)) += vhost-user-fs-pci.o
|
2020-02-14 16:27:36 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o
|
2020-05-22 15:25:10 +03:00
|
|
|
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-common.o vhost-vsock.o
|
2020-05-22 15:25:11 +03:00
|
|
|
obj-$(CONFIG_VHOST_USER_VSOCK) += vhost-vsock-common.o vhost-user-vsock.o
|
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 10:22:37 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_MEM) += virtio-mem.o
|
2020-06-26 10:22:38 +03:00
|
|
|
common-obj-$(call land,$(CONFIG_VIRTIO_MEM),$(CONFIG_VIRTIO_PCI)) += virtio-mem-pci.o
|
2019-02-14 20:35:50 +03:00
|
|
|
|
2019-01-25 15:56:00 +03:00
|
|
|
ifeq ($(CONFIG_VIRTIO_PCI),y)
|
2019-01-03 17:09:58 +03:00
|
|
|
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o
|
2020-05-22 15:25:12 +03:00
|
|
|
obj-$(CONFIG_VHOST_USER_VSOCK) += vhost-user-vsock-pci.o
|
2019-01-03 17:10:04 +03:00
|
|
|
obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk-pci.o
|
2019-05-03 16:00:32 +03:00
|
|
|
obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input-pci.o
|
2019-01-03 17:10:05 +03:00
|
|
|
obj-$(CONFIG_VHOST_USER_SCSI) += vhost-user-scsi-pci.o
|
2019-01-03 17:10:06 +03:00
|
|
|
obj-$(CONFIG_VHOST_SCSI) += vhost-scsi-pci.o
|
2019-01-03 17:09:59 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_INPUT_HOST) += virtio-input-host-pci.o
|
2019-01-03 17:10:00 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-pci.o
|
2019-01-03 17:10:01 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_RNG) += virtio-rng-pci.o
|
2019-01-03 17:10:02 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_BALLOON) += virtio-balloon-pci.o
|
2020-02-14 16:27:43 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu-pci.o
|
2019-01-03 17:10:03 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_9P) += virtio-9p-pci.o
|
2019-01-03 17:10:07 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_SCSI) += virtio-scsi-pci.o
|
2019-01-03 17:10:08 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_BLK) += virtio-blk-pci.o
|
2019-01-03 17:10:09 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_NET) += virtio-net-pci.o
|
2019-01-03 17:10:10 +03:00
|
|
|
obj-$(CONFIG_VIRTIO_SERIAL) += virtio-serial-pci.o
|
2019-01-03 17:09:58 +03:00
|
|
|
endif
|
2019-01-23 09:56:15 +03:00
|
|
|
else
|
|
|
|
common-obj-y += vhost-stub.o
|
2016-10-24 12:13:49 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
common-obj-$(CONFIG_ALL) += vhost-stub.o
|