aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@suse.de>2024-02-20 19:41:09 -0300
committerPeter Xu <peterx@redhat.com>2024-02-28 11:31:28 +0800
commitd13f0026c7a625a5a34a5dea4095a4d9cfa04652 (patch)
tree4364c5c1b223f8d8f5d159fd4b9752f88c874709 /migration
parent11dd7be57524d400652cecf8740a016b3d66b53d (diff)
migration/multifd: Release recv sem_sync earlier
Now that multifd_recv_terminate_threads() is called only once, release the recv side sem_sync earlier like we do for the send side. Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Peter Xu <peterx@redhat.com> Link: https://lore.kernel.org/r/20240220224138.24759-6-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/multifd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/migration/multifd.c b/migration/multifd.c
index fba00b9e8f..43f0820996 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -1105,6 +1105,12 @@ static void multifd_recv_terminate_threads(Error *err)
MultiFDRecvParams *p = &multifd_recv_state->params[i];
/*
+ * multifd_recv_thread may hung at MULTIFD_FLAG_SYNC handle code,
+ * however try to wakeup it without harm in cleanup phase.
+ */
+ qemu_sem_post(&p->sem_sync);
+
+ /*
* We could arrive here for two reasons:
* - normal quit, i.e. everything went fine, just finished
* - error quit: We close the channels so the channel threads
@@ -1162,12 +1168,6 @@ void multifd_recv_cleanup(void)
for (i = 0; i < migrate_multifd_channels(); i++) {
MultiFDRecvParams *p = &multifd_recv_state->params[i];
- /*
- * multifd_recv_thread may hung at MULTIFD_FLAG_SYNC handle code,
- * however try to wakeup it without harm in cleanup phase.
- */
- qemu_sem_post(&p->sem_sync);
-
if (p->thread_created) {
qemu_thread_join(&p->thread);
}