[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/26] migration: Modify ram_init_bitmaps() to report dirty tracki
From: |
Peter Xu |
Subject: |
[PULL 23/26] migration: Modify ram_init_bitmaps() to report dirty tracking errors |
Date: |
Tue, 23 Apr 2024 18:38:10 -0400 |
From: Cédric Le Goater <clg@redhat.com>
The .save_setup() handler has now an Error** argument that we can use
to propagate errors reported by the .log_global_start() handler. Do
that for the RAM. The caller qemu_savevm_state_setup() will store the
error under the migration stream for later detection in the migration
sequence.
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20240320064911.545001-15-clg@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/ram.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 70797ef5d8..daffcd82d4 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2857,9 +2857,8 @@ static void
migration_bitmap_clear_discarded_pages(RAMState *rs)
}
}
-static void ram_init_bitmaps(RAMState *rs)
+static bool ram_init_bitmaps(RAMState *rs, Error **errp)
{
- Error *local_err = NULL;
bool ret = true;
qemu_mutex_lock_ramlist();
@@ -2868,10 +2867,8 @@ static void ram_init_bitmaps(RAMState *rs)
ram_list_init_bitmaps();
/* We don't use dirty log with background snapshots */
if (!migrate_background_snapshot()) {
- ret = memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION,
- &local_err);
+ ret = memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION, errp);
if (!ret) {
- error_report_err(local_err);
goto out_unlock;
}
migration_bitmap_sync_precopy(rs, false);
@@ -2882,7 +2879,7 @@ out_unlock:
if (!ret) {
ram_bitmaps_destroy();
- return;
+ return false;
}
/*
@@ -2890,24 +2887,23 @@ out_unlock:
* containing all 1s to exclude any discarded pages from migration.
*/
migration_bitmap_clear_discarded_pages(rs);
+ return true;
}
-static int ram_init_all(RAMState **rsp)
+static int ram_init_all(RAMState **rsp, Error **errp)
{
- Error *local_err = NULL;
-
- if (!ram_state_init(rsp, &local_err)) {
- error_report_err(local_err);
+ if (!ram_state_init(rsp, errp)) {
return -1;
}
- if (!xbzrle_init(&local_err)) {
- error_report_err(local_err);
+ if (!xbzrle_init(errp)) {
ram_state_cleanup(rsp);
return -1;
}
- ram_init_bitmaps(*rsp);
+ if (!ram_init_bitmaps(*rsp, errp)) {
+ return -1;
+ }
return 0;
}
@@ -3104,8 +3100,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque,
Error **errp)
/* migration has already setup the bitmap, reuse it. */
if (!migration_in_colo_state()) {
- if (ram_init_all(rsp) != 0) {
- error_setg(errp, "%s: failed to setup RAM for migration",
__func__);
+ if (ram_init_all(rsp, errp) != 0) {
compress_threads_save_cleanup();
return -1;
}
--
2.44.0
- [PULL 25/26] migration/multifd: solve zero page causing multiple page faults, (continued)
- [PULL 25/26] migration/multifd: solve zero page causing multiple page faults, Peter Xu, 2024/04/23
- [PULL 05/26] tests/qtest/migration: Add migrate_set_ports into migrate_qmp to update migration port value, Peter Xu, 2024/04/23
- [PULL 12/26] migration: Always report an error in block_save_setup(), Peter Xu, 2024/04/23
- [PULL 14/26] migration: Add Error** argument to vmstate_save(), Peter Xu, 2024/04/23
- [PULL 09/26] tests/qtest/migration: Fix typo for vsock in SocketAddress_to_str, Peter Xu, 2024/04/23
- [PULL 11/26] vfio: Always report an error in vfio_save_setup(), Peter Xu, 2024/04/23
- [PULL 22/26] migration: Add Error** argument to xbzrle_init(), Peter Xu, 2024/04/23
- [PULL 03/26] tests/qtest/migration: Replace migrate_get_connect_uri inplace of migrate_get_socket_address, Peter Xu, 2024/04/23
- [PULL 15/26] migration: Add Error** argument to qemu_savevm_state_setup(), Peter Xu, 2024/04/23
- [PULL 18/26] memory: Add Error** argument to .log_global_start() handler, Peter Xu, 2024/04/23
- [PULL 23/26] migration: Modify ram_init_bitmaps() to report dirty tracking errors,
Peter Xu <=
- [PULL 20/26] memory: Add Error** argument to the global_dirty_log routines, Peter Xu, 2024/04/23
- [PULL 21/26] migration: Add Error** argument to ram_state_init(), Peter Xu, 2024/04/23
- Re: [PULL 00/26] Migration 20240423 patches, Richard Henderson, 2024/04/24