mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
memory: Add Error** argument to the global_dirty_log routines
Now that the log_global*() handlers take an Error** parameter and return a bool, do the same for memory_global_dirty_log_start() and memory_global_dirty_log_stop(). The error is reported in the callers for now and it will be propagated in the call stack in the next changes. To be noted a functional change in ram_init_bitmaps(), if the dirty pages logger fails to start, there is no need to synchronize the dirty pages bitmaps. colo_incoming_start_dirty_log() could be modified in a similar way. Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Anthony Perard <anthony.perard@citrix.com> Cc: Paul Durrant <paul@xen.org> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: David Hildenbrand <david@redhat.com> Cc: Hyman Huang <yong.huang@smartx.com> Signed-off-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Acked-by: Peter Xu <peterx@redhat.com> Link: https://lore.kernel.org/r/20240320064911.545001-12-clg@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
92c20b2fc5
commit
639ec3fbf9
5 changed files with 42 additions and 12 deletions
|
@ -2862,18 +2862,32 @@ static void migration_bitmap_clear_discarded_pages(RAMState *rs)
|
|||
|
||||
static void ram_init_bitmaps(RAMState *rs)
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
bool ret = true;
|
||||
|
||||
qemu_mutex_lock_ramlist();
|
||||
|
||||
WITH_RCU_READ_LOCK_GUARD() {
|
||||
ram_list_init_bitmaps();
|
||||
/* We don't use dirty log with background snapshots */
|
||||
if (!migrate_background_snapshot()) {
|
||||
memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION);
|
||||
ret = memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION,
|
||||
&local_err);
|
||||
if (!ret) {
|
||||
error_report_err(local_err);
|
||||
goto out_unlock;
|
||||
}
|
||||
migration_bitmap_sync_precopy(rs, false);
|
||||
}
|
||||
}
|
||||
out_unlock:
|
||||
qemu_mutex_unlock_ramlist();
|
||||
|
||||
if (!ret) {
|
||||
ram_bitmaps_destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* After an eventual first bitmap sync, fixup the initial bitmap
|
||||
* containing all 1s to exclude any discarded pages from migration.
|
||||
|
@ -3665,6 +3679,8 @@ int colo_init_ram_cache(void)
|
|||
void colo_incoming_start_dirty_log(void)
|
||||
{
|
||||
RAMBlock *block = NULL;
|
||||
Error *local_err = NULL;
|
||||
|
||||
/* For memory_global_dirty_log_start below. */
|
||||
bql_lock();
|
||||
qemu_mutex_lock_ramlist();
|
||||
|
@ -3676,7 +3692,10 @@ void colo_incoming_start_dirty_log(void)
|
|||
/* Discard this dirty bitmap record */
|
||||
bitmap_zero(block->bmap, block->max_length >> TARGET_PAGE_BITS);
|
||||
}
|
||||
memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION);
|
||||
if (!memory_global_dirty_log_start(GLOBAL_DIRTY_MIGRATION,
|
||||
&local_err)) {
|
||||
error_report_err(local_err);
|
||||
}
|
||||
}
|
||||
ram_state->migration_dirty_pages = 0;
|
||||
qemu_mutex_unlock_ramlist();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue