aboutsummaryrefslogtreecommitdiff
path: root/include/hw/virtio
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2023-01-17 12:22:48 +0100
committerJuan Quintela <quintela@redhat.com>2023-02-06 19:22:56 +0100
commit3b95a71b22827d261786b84f38b1e9109f6bf57b (patch)
treeb674bf7ce1b43391e5028eb69aa08cda4cadf96a /include/hw/virtio
parentce1761f0f9f0dde30a56cdcff68c034874fb91a0 (diff)
virtio-mem: Migrate immutable properties early
The bitmap and the size are immutable while migration is active: see virtio_mem_is_busy(). We can migrate this information early, before migrating any actual RAM content. Further, all information we need for sanity checks is immutable as well. Having this information in place early will, for example, allow for properly preallocating memory before touching these memory locations during RAM migration: this way, we can make sure that all memory was actually preallocated and that any user errors (e.g., insufficient hugetlb pages) can be handled gracefully. In contrast, usable_region_size and requested_size can theoretically still be modified on the source while the VM is running. Keep migrating these properties the usual, late, way. Use a new device property to keep behavior of compat machines unmodified. 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>
Diffstat (limited to 'include/hw/virtio')
-rw-r--r--include/hw/virtio/virtio-mem.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/hw/virtio/virtio-mem.h b/include/hw/virtio/virtio-mem.h
index 7745cfc1a3..f15e561785 100644
--- a/include/hw/virtio/virtio-mem.h
+++ b/include/hw/virtio/virtio-mem.h
@@ -31,6 +31,7 @@ OBJECT_DECLARE_TYPE(VirtIOMEM, VirtIOMEMClass,
#define VIRTIO_MEM_BLOCK_SIZE_PROP "block-size"
#define VIRTIO_MEM_ADDR_PROP "memaddr"
#define VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP "unplugged-inaccessible"
+#define VIRTIO_MEM_EARLY_MIGRATION_PROP "x-early-migration"
#define VIRTIO_MEM_PREALLOC_PROP "prealloc"
struct VirtIOMEM {
@@ -74,6 +75,13 @@ struct VirtIOMEM {
/* whether to prealloc memory when plugging new blocks */
bool prealloc;
+ /*
+ * Whether we migrate properties that are immutable while migration is
+ * active early, before state of other devices and especially, before
+ * migrating any RAM content.
+ */
+ bool early_migration;
+
/* notifiers to notify when "size" changes */
NotifierList size_change_notifiers;