migration/colo: make colo_incoming_co() return void

Currently, it always returns 0, no need to check the return value at all.
In addition, enter colo coroutine only if migration_incoming_colo_enabled()
is true.
Once the destination side enters the COLO* state, the COLO process will
take over the remaining processes until COLO exits.

Cc: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
[fixed mangled author email address]
Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
Li Zhijian 2024-05-16 11:45:16 +08:00 committed by Fabiano Rosas
parent 55a331655d
commit 787ea49e80
4 changed files with 7 additions and 13 deletions

View File

@ -49,7 +49,7 @@ void colo_checkpoint_delay_set(void);
* *
* Called with BQL locked, may temporary release BQL. * Called with BQL locked, may temporary release BQL.
*/ */
int coroutine_fn colo_incoming_co(void); void coroutine_fn colo_incoming_co(void);
void colo_shutdown(void); void colo_shutdown(void);
#endif #endif

View File

@ -9,9 +9,8 @@ void colo_shutdown(void)
{ {
} }
int coroutine_fn colo_incoming_co(void) void coroutine_fn colo_incoming_co(void)
{ {
return 0;
} }
void colo_checkpoint_delay_set(void) void colo_checkpoint_delay_set(void)

View File

@ -928,16 +928,13 @@ out:
return NULL; return NULL;
} }
int coroutine_fn colo_incoming_co(void) void coroutine_fn colo_incoming_co(void)
{ {
MigrationIncomingState *mis = migration_incoming_get_current(); MigrationIncomingState *mis = migration_incoming_get_current();
QemuThread th; QemuThread th;
assert(bql_locked()); assert(bql_locked());
assert(migration_incoming_colo_enabled());
if (!migration_incoming_colo_enabled()) {
return 0;
}
qemu_thread_create(&th, "COLO incoming", colo_process_incoming_thread, qemu_thread_create(&th, "COLO incoming", colo_process_incoming_thread,
mis, QEMU_THREAD_JOINABLE); mis, QEMU_THREAD_JOINABLE);
@ -953,6 +950,4 @@ int coroutine_fn colo_incoming_co(void)
/* We hold the global BQL, so it is safe here */ /* We hold the global BQL, so it is safe here */
colo_release_ram_cache(); colo_release_ram_cache();
return 0;
} }

View File

@ -776,9 +776,9 @@ process_incoming_migration_co(void *opaque)
goto fail; goto fail;
} }
if (colo_incoming_co() < 0) { if (migration_incoming_colo_enabled()) {
error_setg(&local_err, "colo incoming failed"); /* yield until COLO exit */
goto fail; colo_incoming_co();
} }
migration_bh_schedule(process_incoming_migration_bh, mis); migration_bh_schedule(process_incoming_migration_bh, mis);