[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/16] migration: Synchronize all CPU states only for non-iterabl
From: |
Peter Xu |
Subject: |
[PATCH 06/16] migration: Synchronize all CPU states only for non-iterable dump |
Date: |
Tue, 14 Jan 2025 18:07:36 -0500 |
Do one shot cpu sync at qemu_savevm_state_complete_precopy_non_iterable(),
instead of coding it separately in two places.
Note that in the context of qemu_savevm_state_complete_precopy(), this
patch is also an optimization for postcopy path, in that we can avoid sync
cpu twice during switchover: before this patch, postcopy_start() invokes
twice on qemu_savevm_state_complete_precopy(), each of them will try to
sync CPU info. In reality, only one of them would be enough.
For background snapshot, there's no intended functional change.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/migration.c | 6 +-----
migration/savevm.c | 5 +++--
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index b33baab950..33c4824b68 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3622,11 +3622,7 @@ static void *bg_migration_thread(void *opaque)
if (migration_stop_vm(s, RUN_STATE_PAUSED)) {
goto fail;
}
- /*
- * Put vCPUs in sync with shadow context structures, then
- * save their state to channel-buffer along with devices.
- */
- cpu_synchronize_all_states();
+
if (qemu_savevm_state_complete_precopy_non_iterable(fb, false)) {
goto fail;
}
diff --git a/migration/savevm.c b/migration/savevm.c
index 5e56a5d9fc..92e77ca92b 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1531,6 +1531,9 @@ int
qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
Error *local_err = NULL;
int ret;
+ /* Making sure cpu states are synchronized before saving non-iterable */
+ cpu_synchronize_all_states();
+
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
if (se->vmsd && se->vmsd->early_setup) {
/* Already saved during qemu_savevm_state_setup(). */
@@ -1584,8 +1587,6 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, bool
iterable_only)
trace_savevm_state_complete_precopy();
- cpu_synchronize_all_states();
-
if (!in_postcopy || iterable_only) {
ret = qemu_savevm_state_complete_precopy_iterable(f, in_postcopy);
if (ret) {
--
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 <=
- [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, 2025/01/14
- [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