On Thu, Feb 01, 2024 at 10:30:19AM -0300, Fabiano Rosas wrote: > > @@ -586,7 +595,7 @@ void multifd_save_cleanup(void) > > if (!migrate_multifd()) { > > return; > > } > > - multifd_send_terminate_threads(NULL); > > + multifd_send_terminate_threads(); > > for (i = 0; i < migrate_multifd_channels(); i++) { > > MultiFDSendParams *p = &multifd_send_state->params[i]; > > We could then move the qemu_thread_join loop into > multifd_send_terminate_threads().
Sure, I can do that. When at it, I found that maybe I should cleanup more things in this function to provide small helpers. I think I'll keep this one alone, while I'll append one more patch to do it. > > (and fix all the bugs we have so that we only progress past > multifd_send_terminate_threads() once all threads have exited and no > more thread is going to spawn) I guess this will still take some effort. I hope that we can avoid some threads from being created at all for either async/tls purpose. For now when I'm doing the cleanup I'll add a TODO too for this. I'll repost a new version for the whole set today. -- Peter Xu