[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/5] migration/multifd: Move multifd_save_setup into migratio
From: |
Peter Xu |
Subject: |
Re: [PATCH 4/5] migration/multifd: Move multifd_save_setup into migration thread |
Date: |
Mon, 5 Feb 2024 13:52:54 +0800 |
On Fri, Feb 02, 2024 at 04:11:27PM -0300, Fabiano Rosas wrote:
> We currently have an unfavorable situation around multifd channels
> creation and the migration thread execution.
>
> We create the multifd channels with qio_channel_socket_connect_async
> -> qio_task_run_in_thread, but only connect them at the
> multifd_new_send_channel_async callback, called from
> qio_task_complete, which is registered as a glib event.
>
> So at multifd_save_setup() we create the channels, but they will only
> be actually usable after the whole multifd_save_setup() calling stack
> returns back to the main loop. Which means that the migration thread
> is already up and running without any possibility for the multifd
> channels to be ready on time.
>
> We currently rely on the channels-ready semaphore blocking
> multifd_send_sync_main() until channels start to come up and release
> it. However there have been bugs recently found when a channel's
> creation fails and multifd_save_cleanup() is allowed to run while
> other channels are still being created.
>
> Let's start to organize this situation by moving the
> multifd_save_setup() call into the migration thread. That way we
> unblock the main-loop to dispatch the completion callbacks and
> actually have a chance of getting the multifd channels ready for when
> the migration thread needs them.
>
> The next patches will deal with the synchronization aspects.
>
> Note that this takes multifd_save_setup() out of the BQL.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
- [PATCH 0/5] migration/multifd: Fix channel creation vs. cleanup races, Fabiano Rosas, 2024/02/02
- [PATCH 1/5] migration/multifd: Join the TLS thread, Fabiano Rosas, 2024/02/02
- [PATCH 2/5] migration/multifd: Remove p->running, Fabiano Rosas, 2024/02/02
- [PATCH 4/5] migration/multifd: Move multifd_save_setup into migration thread, Fabiano Rosas, 2024/02/02
- Re: [PATCH 4/5] migration/multifd: Move multifd_save_setup into migration thread,
Peter Xu <=
- [PATCH 3/5] migration/multifd: Move multifd_save_setup error handling in to the function, Fabiano Rosas, 2024/02/02
- [PATCH 5/5] migration/multifd: Add a synchronization point for channel creation, Fabiano Rosas, 2024/02/02
Re: [PATCH 0/5] migration/multifd: Fix channel creation vs. cleanup races, Peter Xu, 2024/02/05