On Tue, Sep 28, 2021 at 7:49 PM Peter Xu <pet...@redhat.com> wrote: > > On Fri, Sep 24, 2021 at 06:43:49PM +0100, Daniel P. Berrangé wrote: > > > @@ -546,6 +546,7 @@ void multifd_save_cleanup(void) > > > MultiFDSendParams *p = &multifd_send_state->params[i]; > > > Error *local_err = NULL; > > > > > > + qio_channel_async_flush(p->c, NULL); > > > socket_send_channel_destroy(p->c); > > > p->c = NULL; > > > qemu_mutex_destroy(&p->mutex); > > > > This isn't reliable beucase qio_channel_async_flush will return early > > even if not everything is flushed. > > Right, though I think the problem is in patch 2 where we should make sure > flush() will only return if all data sent. > > And at the meantime we may also want to move it to before we send the devices > states for both pre/post copy. multifd_save_cleanup() is called only until > migration completed and we're cleaning stuffs, I'm afraid it's too late, so > potentially the device states can arrive and dest vm running without the > latest > src VM memories.
Thanks for that Peter! I had some trouble sorting out when to flush, and I think I still missed this. I will have thet improved for v3. > > -- > Peter Xu > Best regards, Leonardo