[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/16] migration: Unwrap qemu_savevm_state_complete_precopy() in
From: |
Peter Xu |
Subject: |
[PATCH 12/16] migration: Unwrap qemu_savevm_state_complete_precopy() in postcopy |
Date: |
Tue, 14 Jan 2025 18:07:42 -0500 |
Postcopy invokes qemu_savevm_state_complete_precopy() twice for a long
time, and that caused way too much confusions. Let's clean this up and
make postcopy easier to read.
It's actually fairly straightforward: postcopy starts with saving
non-postcopiable iterables, then later it saves again with non-iterable
only. Move these two calls out makes everything much easier to follow.
Otherwise it's very unclear what qemu_savevm_state_complete_precopy() did
in either of the calls.
No functional change intended.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/savevm.h | 1 +
migration/migration.c | 13 +++++++++++--
migration/savevm.c | 1 -
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/migration/savevm.h b/migration/savevm.h
index c48a53e95e..7957460062 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -44,6 +44,7 @@ void qemu_savevm_state_pending_exact(uint64_t *must_precopy,
uint64_t *can_postcopy);
void qemu_savevm_state_pending_estimate(uint64_t *must_precopy,
uint64_t *can_postcopy);
+int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy);
void qemu_savevm_send_ping(QEMUFile *f, uint32_t value);
void qemu_savevm_send_open_return_path(QEMUFile *f);
int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len);
diff --git a/migration/migration.c b/migration/migration.c
index 2c5674c2ae..a8fe423a2b 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2566,7 +2566,11 @@ static int postcopy_start(MigrationState *ms, Error
**errp)
* Cause any non-postcopiable, but iterative devices to
* send out their final data.
*/
- qemu_savevm_state_complete_precopy(ms->to_dst_file, true);
+ ret = qemu_savevm_state_complete_precopy_iterable(ms->to_dst_file, true);
+ if (ret) {
+ error_setg(errp, "Postcopy save non-postcopiable iterables failed");
+ goto fail;
+ }
/*
* in Finish migrate and with the io-lock held everything should
@@ -2605,7 +2609,12 @@ static int postcopy_start(MigrationState *ms, Error
**errp)
*/
qemu_savevm_send_postcopy_listen(fb);
- qemu_savevm_state_complete_precopy(fb, false);
+ ret = qemu_savevm_state_complete_precopy_non_iterable(fb, true);
+ if (ret) {
+ error_setg(errp, "Postcopy save non-iterable device states failed");
+ goto fail_closefb;
+ }
+
if (migrate_postcopy_ram()) {
qemu_savevm_send_ping(fb, 3);
}
diff --git a/migration/savevm.c b/migration/savevm.c
index 9aef2fa3c9..0ddc4c8eb5 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1477,7 +1477,6 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f)
qemu_fflush(f);
}
-static
int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy)
{
int64_t start_ts_each, end_ts_each;
--
2.47.0
- [PATCH 00/16] migration: Switchover phase refactoring, Peter Xu, 2025/01/14
- [PATCH 01/16] migration: Remove postcopy implications in should_send_vmdesc(), Peter Xu, 2025/01/14
- [PATCH 02/16] migration: Do not construct JSON description if suppressed, Peter Xu, 2025/01/14
- [PATCH 03/16] migration: Optimize postcopy on downtime by avoiding JSON writer, Peter Xu, 2025/01/14
- [PATCH 04/16] migration: Avoid two src-downtime-end tracepoints for postcopy, Peter Xu, 2025/01/14
- [PATCH 05/16] migration: Drop inactivate_disk param in qemu_savevm_state_complete*, Peter Xu, 2025/01/14
- [PATCH 06/16] migration: Synchronize all CPU states only for non-iterable dump, Peter Xu, 2025/01/14
- [PATCH 08/16] migration: Adjust locking in migration_maybe_pause(), Peter Xu, 2025/01/14
- [PATCH 07/16] migration: Adjust postcopy bandwidth during switchover, Peter Xu, 2025/01/14
- [PATCH 10/16] migration: Take BQL slightly longer in postcopy_start(), Peter Xu, 2025/01/14
- [PATCH 12/16] migration: Unwrap qemu_savevm_state_complete_precopy() in postcopy,
Peter Xu <=
- [PATCH 13/16] migration: Cleanup qemu_savevm_state_complete_precopy(), Peter Xu, 2025/01/14
- [PATCH 11/16] migration: Notify COMPLETE once for postcopy, Peter Xu, 2025/01/14
- [PATCH 14/16] migration: Always set DEVICE state, Peter Xu, 2025/01/14
- [PATCH 15/16] migration: Merge precopy/postcopy on switchover start, Peter Xu, 2025/01/14
- [PATCH 16/16] migration: Trivial cleanup on JSON writer of vmstate_save(), Peter Xu, 2025/01/14
- [PATCH 09/16] migration: Drop cached migration state in migration_maybe_pause(), Peter Xu, 2025/01/14
- Re: [PATCH 00/16] migration: Switchover phase refactoring, Jiri Denemark, 2025/01/15
- Re: [PATCH 00/16] migration: Switchover phase refactoring, Juraj Marcin, 2025/01/15
- Re: [PATCH 00/16] migration: Switchover phase refactoring, Fabiano Rosas, 2025/01/15