virtio-mem: Migrate immutable properties early
commit3b95a71b22827d261786b84f38b1e9109f6bf57b
authorDavid Hildenbrand <david@redhat.com>
Tue, 17 Jan 2023 11:22:48 +0000 (17 12:22 +0100)
committerJuan Quintela <quintela@redhat.com>
Mon, 6 Feb 2023 18:22:56 +0000 (6 19:22 +0100)
treeb674bf7ce1b43391e5028eb69aa08cda4cadf96a
parentce1761f0f9f0dde30a56cdcff68c034874fb91a0
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>
hw/core/machine.c
hw/virtio/virtio-mem.c
include/hw/virtio/virtio-mem.h