[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/68] libvhost-user: Bump up VHOST_USER_MAX_RAM_SLOTS to 509
From: |
Michael S. Tsirkin |
Subject: |
[PULL 13/68] libvhost-user: Bump up VHOST_USER_MAX_RAM_SLOTS to 509 |
Date: |
Tue, 12 Mar 2024 18:26:07 -0400 |
From: David Hildenbrand <david@redhat.com>
Let's support up to 509 mem slots, just like vhost in the kernel usually
does and the rust vhost-user implementation recently [1] started doing.
This is required to properly support memory hotplug, either using
multiple DIMMs (ACPI supports up to 256) or using virtio-mem.
The 509 used to be the KVM limit, it supported 512, but 3 were
used for internal purposes. Currently, KVM supports more than 512, but
it usually doesn't make use of more than ~260 (i.e., 256 DIMMs + boot
memory), except when other memory devices like PCI devices with BARs are
used. So, 509 seems to work well for vhost in the kernel.
Details can be found in the QEMU change that made virtio-mem consume
up to 256 mem slots across all virtio-mem devices. [2]
509 mem slots implies 509 VMAs/mappings in the worst case (even though,
in practice with virtio-mem we won't be seeing more than ~260 in most
setups).
With max_map_count under Linux defaulting to 64k, 509 mem slots
still correspond to less than 1% of the maximum number of mappings.
There are plenty left for the application to consume.
[1] https://github.com/rust-vmm/vhost/pull/224
[2] https://lore.kernel.org/all/20230926185738.277351-1-david@redhat.com/
Reviewed-by: Raphael Norwitz <raphael@enfabrica.net>
Acked-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20240214151701.29906-3-david@redhat.com>
Tested-by: Mario Casquero <mcasquer@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
subprojects/libvhost-user/libvhost-user.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/subprojects/libvhost-user/libvhost-user.h
b/subprojects/libvhost-user/libvhost-user.h
index c882b4e3a2..deb40e77b3 100644
--- a/subprojects/libvhost-user/libvhost-user.h
+++ b/subprojects/libvhost-user/libvhost-user.h
@@ -31,10 +31,12 @@
#define VHOST_MEMORY_BASELINE_NREGIONS 8
/*
- * Set a reasonable maximum number of ram slots, which will be supported by
- * any architecture.
+ * vhost in the kernel usually supports 509 mem slots. 509 used to be the
+ * KVM limit, it supported 512, but 3 were used for internal purposes. This
+ * limit is sufficient to support many DIMMs and virtio-mem in
+ * "dynamic-memslots" mode.
*/
-#define VHOST_USER_MAX_RAM_SLOTS 32
+#define VHOST_USER_MAX_RAM_SLOTS 509
#define VHOST_USER_HDR_SIZE offsetof(VhostUserMsg, payload.u64)
--
MST
- [PULL 04/68] vdpa: add vhost_vdpa_set_address_space_id trace, (continued)
- [PULL 04/68] vdpa: add vhost_vdpa_set_address_space_id trace, Michael S. Tsirkin, 2024/03/12
- [PULL 08/68] vdpa: add trace event for vhost_vdpa_net_load_mq, Michael S. Tsirkin, 2024/03/12
- [PULL 05/68] vdpa: add vhost_vdpa_get_vring_base trace for svq mode, Michael S. Tsirkin, 2024/03/12
- [PULL 09/68] vdpa: define SVQ transitioning state for mode switching, Michael S. Tsirkin, 2024/03/12
- [PULL 10/68] vdpa: indicate transitional state for SVQ switching, Michael S. Tsirkin, 2024/03/12
- [PULL 06/68] vdpa: add vhost_vdpa_set_dev_vring_base trace for svq mode, Michael S. Tsirkin, 2024/03/12
- [PULL 07/68] vdpa: add trace events for vhost_vdpa_net_load_cmd, Michael S. Tsirkin, 2024/03/12
- [PULL 12/68] libvhost-user: Dynamically allocate memory for memory slots, Michael S. Tsirkin, 2024/03/12
- [PULL 01/68] vdpa: add back vhost_vdpa_net_first_nc_vdpa, Michael S. Tsirkin, 2024/03/12
- [PULL 11/68] vdpa: fix network breakage after cancelling migration, Michael S. Tsirkin, 2024/03/12
- [PULL 13/68] libvhost-user: Bump up VHOST_USER_MAX_RAM_SLOTS to 509,
Michael S. Tsirkin <=
- [PULL 14/68] libvhost-user: Factor out removing all mem regions, Michael S. Tsirkin, 2024/03/12
- [PULL 15/68] libvhost-user: Merge vu_set_mem_table_exec_postcopy() into vu_set_mem_table_exec(), Michael S. Tsirkin, 2024/03/12
- [PULL 16/68] libvhost-user: Factor out adding a memory region, Michael S. Tsirkin, 2024/03/12
- [PULL 17/68] libvhost-user: No need to check for NULL when unmapping, Michael S. Tsirkin, 2024/03/12
- [PULL 18/68] libvhost-user: Don't zero out memory for memory regions, Michael S. Tsirkin, 2024/03/12
- [PULL 19/68] libvhost-user: Don't search for duplicates when removing memory regions, Michael S. Tsirkin, 2024/03/12
- [PULL 23/68] libvhost-user: Factor out vq usability check, Michael S. Tsirkin, 2024/03/12
- [PULL 26/68] pcie: Support PCIe Gen5/Gen6 link speeds, Michael S. Tsirkin, 2024/03/12
- [PULL 21/68] libvhost-user: Speedup gpa_to_mem_region() and vu_gpa_to_va(), Michael S. Tsirkin, 2024/03/12
- [PULL 22/68] libvhost-user: Use most of mmap_offset as fd_offset, Michael S. Tsirkin, 2024/03/12