[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/27] migration/multifd: Document two places for mapped-ram
From: |
peterx |
Subject: |
[PULL 27/27] migration/multifd: Document two places for mapped-ram |
Date: |
Mon, 4 Mar 2024 09:26:34 +0800 |
From: Peter Xu <peterx@redhat.com>
Add two documentations for mapped-ram migration on two spots that may not
be extremely clear.
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: 20240301091524.39900-1-peterx@redhat.com">https://lore.kernel.org/r/20240301091524.39900-1-peterx@redhat.com
Cc: Prasad Pandit <ppandit@redhat.com>
[peterx: fix two English errors per Prasad]
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/multifd.c | 12 ++++++++++++
migration/ram.c | 8 +++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/migration/multifd.c b/migration/multifd.c
index b4e5a9dfcc..d4a44da559 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -709,6 +709,18 @@ static bool multifd_send_cleanup_channel(MultiFDSendParams
*p, Error **errp)
{
if (p->c) {
migration_ioc_unregister_yank(p->c);
+ /*
+ * An explicit close() on the channel here is normally not
+ * required, but can be helpful for "file:" iochannels, where it
+ * will include fdatasync() to make sure the data is flushed to the
+ * disk backend.
+ *
+ * The object_unref() cannot guarantee that because: (1) finalize()
+ * of the iochannel is only triggered on the last reference, and
+ * it's not guaranteed that we always hold the last refcount when
+ * reaching here, and, (2) even if finalize() is invoked, it only
+ * does a close(fd) without data flush.
+ */
qio_channel_close(p->c, &error_abort);
object_unref(OBJECT(p->c));
p->c = NULL;
diff --git a/migration/ram.c b/migration/ram.c
index 1f1b5297cf..c79e3de521 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -4258,7 +4258,13 @@ static int ram_load_precopy(QEMUFile *f)
switch (flags & ~RAM_SAVE_FLAG_CONTINUE) {
case RAM_SAVE_FLAG_MEM_SIZE:
ret = parse_ramblocks(f, addr);
-
+ /*
+ * For mapped-ram migration (to a file) using multifd, we sync
+ * once and for all here to make sure all tasks we queued to
+ * multifd threads are completed, so that all the ramblocks
+ * (including all the guest memory pages within) are fully
+ * loaded after this sync returns.
+ */
if (migrate_mapped_ram()) {
multifd_recv_sync_main();
}
--
2.44.0
- [PULL 19/27] migration/multifd: Add a wrapper for channels_created, (continued)
- [PULL 19/27] migration/multifd: Add a wrapper for channels_created, peterx, 2024/03/03
- [PULL 20/27] migration/multifd: Add outgoing QIOChannelFile support, peterx, 2024/03/03
- [PULL 23/27] migration/multifd: Support outgoing mapped-ram stream format, peterx, 2024/03/03
- [PULL 26/27] tests/qtest/migration: Add a multifd + mapped-ram migration test, peterx, 2024/03/03
- [PULL 25/27] migration/multifd: Add mapped-ram support to fd: URI, peterx, 2024/03/03
- [PULL 22/27] migration/multifd: Prepare multifd sync for mapped-ram migration, peterx, 2024/03/03
- [PULL 27/27] migration/multifd: Document two places for mapped-ram,
peterx <=
- Re: [PULL 00/27] Migration next patches, Peter Maydell, 2024/03/05