On Thu, Feb 29, 2024 at 12:30:13PM -0300, Fabiano Rosas wrote: > The mapped-ram migration can be performed live or non-live, but it is > always asynchronous, i.e. the source machine and the destination > machine are not migrating at the same time. We only need some pieces > of the multifd sync operations. > > multifd_send_sync_main() > ------------------------ > Issued by the ram migration code on the migration thread, causes the > multifd send channels to synchronize with the migration thread and > makes the sending side emit a packet with the MULTIFD_FLUSH flag. > > With mapped-ram we want to maintain the sync on the sending side > because that provides ordering between the rounds of dirty pages when > migrating live. > > MULTIFD_FLUSH > ------------- > On the receiving side, the presence of the MULTIFD_FLUSH flag on a > packet causes the receiving channels to start synchronizing with the > main thread. > > We're not using packets with mapped-ram, so there's no MULTIFD_FLUSH > flag and therefore no channel sync on the receiving side. > > multifd_recv_sync_main() > ------------------------ > Issued by the migration thread when the ram migration flag > RAM_SAVE_FLAG_MULTIFD_FLUSH is received, causes the migration thread > on the receiving side to start synchronizing with the recv > channels. Due to compatibility, this is also issued when > RAM_SAVE_FLAG_EOS is received. > > For mapped-ram we only need to synchronize the channels at the end of > migration to avoid doing cleanup before the channels have finished > their IO. > > Make sure the multifd syncs are only issued at the appropriate times. > > Note that due to pre-existing backward compatibility issues, we have > the multifd_flush_after_each_section property that can cause a sync to > happen at EOS. Since the EOS flag is needed on the stream, allow > mapped-ram to just ignore it. > > Also emit an error if any other unexpected flags are found on the > stream. > > Signed-off-by: Fabiano Rosas <faro...@suse.de>
Reviewed-by: Peter Xu <pet...@redhat.com> -- Peter Xu