aboutsummaryrefslogtreecommitdiff
path: root/softmmu
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2021-04-29 13:27:02 +0200
committerDr. David Alan Gilbert <dgilbert@redhat.com>2021-05-13 18:21:13 +0100
commitc7c0e72408df5e7821c0e995122fb2fe0ac001f1 (patch)
tree4328611e971fa50c3a0c8c16dade8431c5f72fcb /softmmu
parente15c7d1e8c34bbffec2aa88f8fe7cd9812b1c71f (diff)
migration/ram: Handle RAM block resizes during precopy
Resizing while migrating is dangerous and does not work as expected. The whole migration code works on the usable_length of ram blocks and does not expect this to change at random points in time. In the case of precopy, the ram block size must not change on the source, after syncing the RAM block list in ram_save_setup(), so as long as the guest is still running on the source. Resizing can be trigger *after* (but not during) a reset in ACPI code by the guest - hw/arm/virt-acpi-build.c:acpi_ram_update() - hw/i386/acpi-build.c:acpi_ram_update() Use the ram block notifier to get notified about resizes. Let's simply cancel migration and indicate the reason. We'll continue running on the source. No harm done. Update the documentation. Postcopy will be handled separately. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20210429112708.12291-5-david@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Manual merge
Diffstat (limited to 'softmmu')
-rw-r--r--softmmu/physmem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 81ec3b85b9..813a3efe8e 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -1798,8 +1798,9 @@ static int memory_try_enable_merging(void *addr, size_t len)
return qemu_madvise(addr, len, QEMU_MADV_MERGEABLE);
}
-/* Only legal before guest might have detected the memory size: e.g. on
- * incoming migration, or right after reset.
+/*
+ * Resizing RAM while migrating can result in the migration being canceled.
+ * Care has to be taken if the guest might have already detected the memory.
*
* As memory core doesn't know how is memory accessed, it is up to
* resize callback to update device state and/or add assertions to detect