[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/15] migration: Reference migration state around loadvm_postcopy
From: |
peterx |
Subject: |
[PULL 12/15] migration: Reference migration state around loadvm_postcopy_handle_run_bh |
Date: |
Fri, 26 Jan 2024 12:17:22 +0800 |
From: Fabiano Rosas <farosas@suse.de>
We need to hold a reference to the current_migration object around
async calls to avoid it been freed while still in use. Even on this
load-side function, we might still use the MigrationState, e.g to
check for capabilities.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Link: 20240119233922.32588-4-farosas@suse.de">https://lore.kernel.org/r/20240119233922.32588-4-farosas@suse.de
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/savevm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/migration/savevm.c b/migration/savevm.c
index 6410705ebe..93387350c7 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2174,6 +2174,7 @@ static void loadvm_postcopy_handle_run_bh(void *opaque)
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,6 +2190,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);
/* We need to finish reading the stream from the package
--
2.43.0
- [PULL 05/15] analyze-migration.py: Remove trick on parsing ramblocks, (continued)
- [PULL 07/15] ci: Add a migration compatibility test job, peterx, 2024/01/25
- [PULL 08/15] ci: Disable migration compatibility tests for aarch64, peterx, 2024/01/25
- [PULL 09/15] migration/yank: Use channel features, peterx, 2024/01/25
- [PULL 10/15] migration: Fix use-after-free of migration state object, peterx, 2024/01/25
- [PULL 11/15] migration: Take reference to migration state around bg_migration_vm_start_bh, peterx, 2024/01/25
- [PULL 12/15] migration: Reference migration state around loadvm_postcopy_handle_run_bh,
peterx <=
- [PULL 14/15] migration: Centralize BH creation and dispatch, peterx, 2024/01/25
- [PULL 13/15] migration: Add a wrapper to qemu_bh_schedule, peterx, 2024/01/25
- [PULL 15/15] Make 'uri' optional for migrate QAPI, peterx, 2024/01/25
- Re: [PULL 00/15] Migration 20240126 patches, Peter Maydell, 2024/01/26