[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 16/26] migration: Modify ram_init_bitmaps() to report dirty tr
From: |
Cédric Le Goater |
Subject: |
[PATCH v3 16/26] migration: Modify ram_init_bitmaps() to report dirty tracking errors |
Date: |
Mon, 4 Mar 2024 13:28:34 +0100 |
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>
---
migration/ram.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index
3d9c08cfae8a59031a7c1b3c70721c2a90daceba..b12a2f24335be4b2b009aabfe431f4e5a6b4d9a9
100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2801,9 +2801,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();
@@ -2812,10 +2811,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);
@@ -2825,7 +2822,7 @@ out_unlock:
qemu_mutex_unlock_ramlist();
if (!ret) {
- return;
+ return false;
}
/*
@@ -2833,9 +2830,10 @@ 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)
{
if (ram_state_init(rsp)) {
return -1;
@@ -2846,7 +2844,9 @@ static int ram_init_all(RAMState **rsp)
return -1;
}
- ram_init_bitmaps(*rsp);
+ if (!ram_init_bitmaps(*rsp, errp)) {
+ return -1;
+ }
return 0;
}
@@ -2961,8 +2961,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
- [PATCH v3 14/26] memory: Add Error** argument to .log_global*() handlers, (continued)
- [PATCH v3 14/26] memory: Add Error** argument to .log_global*() handlers, Cédric Le Goater, 2024/03/04
- [PATCH v3 12/26] migration: Add Error** argument to .save_setup() handler, Cédric Le Goater, 2024/03/04
- [PATCH v3 17/26] vfio: Add Error** argument to .set_dirty_page_tracking() handler, Cédric Le Goater, 2024/03/04
- [PATCH v3 19/26] vfio: Add Error** argument to vfio_devices_dma_logging_stop(), Cédric Le Goater, 2024/03/04
- [PATCH v3 11/26] migration: Add Error** argument to qemu_savevm_state_setup(), Cédric Le Goater, 2024/03/04
- [PATCH v3 15/26] memory: Add Error** argument to the global_dirty_log routines, Cédric Le Goater, 2024/03/04
- [PATCH v3 16/26] migration: Modify ram_init_bitmaps() to report dirty tracking errors,
Cédric Le Goater <=
- [PATCH v3 22/26] vfio: Reverse test on vfio_get_dirty_bitmap(), Cédric Le Goater, 2024/03/04
- [PATCH v3 25/26] vfio: Also trace event failures in vfio_save_complete_precopy(), Cédric Le Goater, 2024/03/04
- [PATCH v3 26/26] vfio: Extend vfio_set_migration_error() with Error* argument, Cédric Le Goater, 2024/03/04
- [PATCH v3 20/26] vfio: Use new Error** argument in vfio_save_setup(), Cédric Le Goater, 2024/03/04
- [PATCH v3 18/26] vfio: Add Error** argument to vfio_devices_dma_logging_start(), Cédric Le Goater, 2024/03/04
- [PATCH v3 24/26] vfio: Add Error** argument to .get_dirty_bitmap() handler, Cédric Le Goater, 2024/03/04
- [PATCH v3 23/26] memory: Add Error** argument to memory_get_xlat_addr(), Cédric Le Goater, 2024/03/04
- [PATCH v3 21/26] vfio: Add Error** argument to .vfio_save_config() handler, Cédric Le Goater, 2024/03/04
- Re: [PATCH v3 00/26] migration: Improve error reporting, Peter Xu, 2024/03/05