mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
migration: Centralize BH creation and dispatch
Now that the migration state reference counting is correct, further wrap the bottom half dispatch process to avoid future issues. Move BH creation and scheduling together and wrap the dispatch with an intermediary function that will ensure we always keep the ref/unref balanced. Also move the responsibility of deleting the BH into the wrapper and remove the now unnecessary pointers. Signed-off-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240119233922.32588-6-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
699d9476a0
commit
44d0d456d7
3 changed files with 40 additions and 37 deletions
|
@ -2171,10 +2171,7 @@ static void loadvm_postcopy_handle_run_bh(void *opaque)
|
|||
runstate_set(RUN_STATE_PAUSED);
|
||||
}
|
||||
|
||||
qemu_bh_delete(mis->bh);
|
||||
|
||||
trace_vmstate_downtime_checkpoint("dst-postcopy-bh-vm-started");
|
||||
object_unref(OBJECT(migration_get_current()));
|
||||
}
|
||||
|
||||
/* After all discards we can start running and asking for pages */
|
||||
|
@ -2189,9 +2186,7 @@ static int loadvm_postcopy_handle_run(MigrationIncomingState *mis)
|
|||
}
|
||||
|
||||
postcopy_state_set(POSTCOPY_INCOMING_RUNNING);
|
||||
mis->bh = qemu_bh_new(loadvm_postcopy_handle_run_bh, mis);
|
||||
object_ref(OBJECT(migration_get_current()));
|
||||
qemu_bh_schedule(mis->bh);
|
||||
migration_bh_schedule(loadvm_postcopy_handle_run_bh, mis);
|
||||
|
||||
/* We need to finish reading the stream from the package
|
||||
* and also stop reading anything more from the stream that loaded the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue