From 94bccae527f1ab8328cc7692532046d700e2ca71 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Mon, 5 Feb 2024 19:27:07 +0100 Subject: [PATCH 22/22] virtio-mem: default-enable "dynamic-memslots" RH-Author: David Hildenbrand RH-MergeRequest: 220: virtio-mem: default-enable "dynamic-memslots" RH-Jira: RHEL-24045 RH-Acked-by: Miroslav Rezanina RH-Commit: [1/1] d9a60acd7de1d8703ea3ca938e388e19f31f5347 JIRA: https://issues.redhat.com/browse/RHEL-24045 Upstream: RHEL only We only support selected vhost-user devices in combination with virtio-mem in RHEL. One devices that works well is virtiofsd, devices that are currently incompatible include DPDK and SPDK. The vhost devices we support must be compatible with the dynamic-memslot feature (i.e., support at least 509 memslots, support dynamically adding/ removing memslots), such that setting "dynamic-memslots=on" will work a expected and not make certain QEMU commandlines or hotplug of vhost-user devices bail out. Let's set "dynamic-memslots=on" starting with RHEL 9.4, so we get the benefits (i.e., reduced metadata consumption in KVM, majority of unplugged memory being inaccessible) as default. When wanting to run virtio-mem with incompatible vhost-user devices, it might just work (if the vhost-user device is created before the virtio-mem device), or the feature can be manually disabled by specifying "dynamic-memslots=off". Signed-off-by: David Hildenbrand --- hw/core/machine.c | 2 ++ hw/virtio/virtio-mem.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 446601ee30..309f6ba685 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -78,6 +78,8 @@ GlobalProperty hw_compat_rhel_9_4[] = { { "vfio-pci-nohotplug", "x-ramfb-migrate", "off" }, /* hw_compat_rhel_9_4 from hw_compat_8_1 */ { "igb", "x-pcie-flr-init", "off" }, + /* hw_compat_rhel_9_4 jira RHEL-24045 */ + { "virtio-mem", "dynamic-memslots", "off" }, }; const size_t hw_compat_rhel_9_4_len = G_N_ELEMENTS(hw_compat_rhel_9_4); diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 75ee38aa46..00ca91e8fe 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -1696,8 +1696,9 @@ static Property virtio_mem_properties[] = { #endif DEFINE_PROP_BOOL(VIRTIO_MEM_EARLY_MIGRATION_PROP, VirtIOMEM, early_migration, true), + /* RHEL: default-enable "dynamic-memslots" (jira RHEL-24045) */ DEFINE_PROP_BOOL(VIRTIO_MEM_DYNAMIC_MEMSLOTS_PROP, VirtIOMEM, - dynamic_memslots, false), + dynamic_memslots, true), DEFINE_PROP_END_OF_LIST(), }; -- 2.39.3