[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/26] virtio-mem: Fail if a memory backend with "prealloc=on" is
From: |
Juan Quintela |
Subject: |
[PULL 17/26] virtio-mem: Fail if a memory backend with "prealloc=on" is specified |
Date: |
Thu, 2 Feb 2023 17:06:31 +0100 |
From: David Hildenbrand <david@redhat.com>
"prealloc=on" for the memory backend does not work as expected, as
virtio-mem will simply discard all preallocated memory immediately again.
In the best case, it's an expensive NOP. In the worst case, it's an
unexpected allocation error.
Instead, "prealloc=on" should be specified for the virtio-mem device only,
such that virtio-mem will try preallocating memory before plugging
memory dynamically to the guest. Fail if such a memory backend is
provided.
Tested-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>S
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/virtio/virtio-mem.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
index 1ed1f5a4af..02f7b5469a 100644
--- a/hw/virtio/virtio-mem.c
+++ b/hw/virtio/virtio-mem.c
@@ -772,6 +772,12 @@ static void virtio_mem_device_realize(DeviceState *dev,
Error **errp)
error_setg(errp, "'%s' property specifies an unsupported memdev",
VIRTIO_MEM_MEMDEV_PROP);
return;
+ } else if (vmem->memdev->prealloc) {
+ error_setg(errp, "'%s' property specifies a memdev with preallocation"
+ " enabled: %s. Instead, specify 'prealloc=on' for the"
+ " virtio-mem device. ", VIRTIO_MEM_MEMDEV_PROP,
+ object_get_canonical_path_component(OBJECT(vmem->memdev)));
+ return;
}
if ((nb_numa_nodes && vmem->node >= nb_numa_nodes) ||
--
2.39.1
- [PULL 04/26] migration: Remove unused threshold_size parameter, (continued)
- [PULL 04/26] migration: Remove unused threshold_size parameter, Juan Quintela, 2023/02/02
- [PULL 05/26] migration: simplify migration_iteration_run(), Juan Quintela, 2023/02/02
- [PULL 09/26] migration/ram: Don't explicitly unprotect when unregistering uffd-wp, Juan Quintela, 2023/02/02
- [PULL 07/26] migration/ram: Fix populate_read_range(), Juan Quintela, 2023/02/02
- [PULL 08/26] migration/ram: Fix error handling in ram_write_tracking_start(), Juan Quintela, 2023/02/02
- [PULL 10/26] migration/ram: Rely on used_length for uffd_change_protection(), Juan Quintela, 2023/02/02
- [PULL 12/26] migration/savevm: Move more savevm handling into vmstate_save(), Juan Quintela, 2023/02/02
- [PULL 13/26] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), Juan Quintela, 2023/02/02
- [PULL 14/26] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Juan Quintela, 2023/02/02
- [PULL 16/26] migration/ram: Factor out check for advised postcopy, Juan Quintela, 2023/02/02
- [PULL 17/26] virtio-mem: Fail if a memory backend with "prealloc=on" is specified,
Juan Quintela <=
- [PULL 15/26] migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and VMSTATE_BITMAP_TEST(), Juan Quintela, 2023/02/02
- [PULL 06/26] util/userfaultfd: Add uffd_open(), Juan Quintela, 2023/02/02
- [PULL 03/26] migration: Split save_live_pending() into state_pending_*, Juan Quintela, 2023/02/02
- [PULL 18/26] virtio-mem: Migrate immutable properties early, Juan Quintela, 2023/02/02
- [PULL 19/26] virtio-mem: Proper support for preallocation with migration, Juan Quintela, 2023/02/02
- [PULL 11/26] migration/ram: Optimize ram_write_tracking_start() for RamDiscardManager, Juan Quintela, 2023/02/02
- [PULL 23/26] migration: Perform vmsd structure check during tests, Juan Quintela, 2023/02/02
- [PULL 22/26] migration: Add canary to VMSTATE_END_OF_LIST, Juan Quintela, 2023/02/02
- [PULL 24/26] migration/dirtyrate: Show sample pages only in page-sampling mode, Juan Quintela, 2023/02/02
- [PULL 20/26] migration: Show downtime during postcopy phase, Juan Quintela, 2023/02/02