[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/34] migration/multifd: Allow multifd sync without flush
From: |
Fabiano Rosas |
Subject: |
[PULL 24/34] migration/multifd: Allow multifd sync without flush |
Date: |
Wed, 4 Sep 2024 09:44:07 -0300 |
Separate the multifd sync from flushing the client data to the
channels. These two operations are closely related but not strictly
necessary to be executed together.
The multifd sync is intrinsic to how multifd works. The multiple
channels operate independently and may finish IO out of order in
relation to each other. This applies also between the source and
destination QEMU.
Flushing the data that is left in the client-owned data structures
(e.g. MultiFDPages_t) prior to sync is usually the right thing to do,
but that is particular to how the ram migration is implemented with
several passes over dirty data.
Make these two routines separate, allowing future code to call the
sync by itself if needed. This also allows the usage of
multifd_ram_send to be isolated to ram code.
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/multifd.c | 13 +++++++++----
migration/multifd.h | 1 +
migration/ram.c | 8 ++++----
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/migration/multifd.c b/migration/multifd.c
index cb7a121eb0..ce08257706 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -914,11 +914,8 @@ static int multifd_zero_copy_flush(QIOChannel *c)
return ret;
}
-int multifd_send_sync_main(void)
+int multifd_ram_flush_and_sync(void)
{
- int i;
- bool flush_zero_copy;
-
if (!migrate_multifd()) {
return 0;
}
@@ -930,6 +927,14 @@ int multifd_send_sync_main(void)
}
}
+ return multifd_send_sync_main();
+}
+
+int multifd_send_sync_main(void)
+{
+ int i;
+ bool flush_zero_copy;
+
flush_zero_copy = migrate_zero_copy_send();
for (i = 0; i < migrate_multifd_channels(); i++) {
diff --git a/migration/multifd.h b/migration/multifd.h
index 5fa384d9af..00c872dfda 100644
--- a/migration/multifd.h
+++ b/migration/multifd.h
@@ -270,4 +270,5 @@ static inline uint32_t multifd_ram_page_count(void)
void multifd_ram_save_setup(void);
void multifd_ram_save_cleanup(void);
+int multifd_ram_flush_and_sync(void);
#endif
diff --git a/migration/ram.c b/migration/ram.c
index 1815b2557b..67ca3d5d51 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1326,7 +1326,7 @@ static int find_dirty_block(RAMState *rs,
PageSearchStatus *pss)
(!migrate_multifd_flush_after_each_section() ||
migrate_mapped_ram())) {
QEMUFile *f = rs->pss[RAM_CHANNEL_PRECOPY].pss_channel;
- int ret = multifd_send_sync_main();
+ int ret = multifd_ram_flush_and_sync();
if (ret < 0) {
return ret;
}
@@ -3066,7 +3066,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque,
Error **errp)
}
bql_unlock();
- ret = multifd_send_sync_main();
+ ret = multifd_ram_flush_and_sync();
bql_lock();
if (ret < 0) {
error_setg(errp, "%s: multifd synchronization failed", __func__);
@@ -3213,7 +3213,7 @@ out:
&& migration_is_setup_or_active()) {
if (migrate_multifd() && migrate_multifd_flush_after_each_section() &&
!migrate_mapped_ram()) {
- ret = multifd_send_sync_main();
+ ret = multifd_ram_flush_and_sync();
if (ret < 0) {
return ret;
}
@@ -3285,7 +3285,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
}
}
- ret = multifd_send_sync_main();
+ ret = multifd_ram_flush_and_sync();
if (ret < 0) {
return ret;
}
--
2.35.3
- [PULL 14/34] migration/multifd: Remove pages->allocated, (continued)
- [PULL 14/34] migration/multifd: Remove pages->allocated, Fabiano Rosas, 2024/09/04
- [PULL 12/34] migration/multifd: Reduce access to p->pages, Fabiano Rosas, 2024/09/04
- [PULL 17/34] migration/multifd: Make MultiFDPages_t:offset a flexible array member, Fabiano Rosas, 2024/09/04
- [PULL 13/34] migration/multifd: Inline page_size and page_count, Fabiano Rosas, 2024/09/04
- [PULL 18/34] migration/multifd: Replace p->pages with an union pointer, Fabiano Rosas, 2024/09/04
- [PULL 19/34] migration/multifd: Move pages accounting into multifd_send_zero_page_detect(), Fabiano Rosas, 2024/09/04
- [PULL 20/34] migration/multifd: Remove total pages tracing, Fabiano Rosas, 2024/09/04
- [PULL 21/34] migration/multifd: Isolate ram pages packet data, Fabiano Rosas, 2024/09/04
- [PULL 22/34] migration/multifd: Don't send ram data during SYNC, Fabiano Rosas, 2024/09/04
- [PULL 23/34] migration/multifd: Replace multifd_send_state->pages with client data, Fabiano Rosas, 2024/09/04
- [PULL 24/34] migration/multifd: Allow multifd sync without flush,
Fabiano Rosas <=
- [PULL 25/34] migration/multifd: Standardize on multifd ops names, Fabiano Rosas, 2024/09/04
- [PULL 26/34] migration/multifd: Register nocomp ops dynamically, Fabiano Rosas, 2024/09/04
- [PULL 27/34] migration/multifd: Move nocomp code into multifd-nocomp.c, Fabiano Rosas, 2024/09/04
- [PULL 29/34] migration/multifd: Stop changing the packet on recv side, Fabiano Rosas, 2024/09/04
- [PULL 28/34] migration/multifd: Make MultiFDMethods const, Fabiano Rosas, 2024/09/04
- [PULL 30/34] migration/multifd: Fix p->iov leak in multifd-uadk.c, Fabiano Rosas, 2024/09/04