Hi,

On Mon, 31 Mar 2025 at 20:49, Fabiano Rosas <faro...@suse.de> wrote:
> > +static bool ram_save_postcopy_prepare(QEMUFile *f, void *opaque, Error 
> > **errp)
> > +{
> > +    int ret;
> > +
> > +    if (migrate_multifd()) {
> > +        /*
> > +         * When multifd is enabled, source QEMU needs to make sure all the
> > +         * pages queued before postcopy starts to be flushed.
>
> s/to be/have been/
>
> > +         *
> > +         * Meanwhile, the load of these pages must happen before switching
>
> s/Meanwhile,//
>
> > +         * to postcopy.  It's because loading of guest pages (so far) in
> > +         * multifd recv threads is still non-atomic, so the load cannot
> > +         * happen with vCPUs running on destination side.
> > +         *
> > +         * This flush and sync will guarantee those pages loaded _before_
>
> s/loaded/are loaded/
>
> > +         * postcopy starts on destination. The rational is, this happens
>
> s/rational/rationale/
>
> > +         * before VM stops (and before source QEMU sends all the rest of
> > +         * the postcopy messages).  So when the destination QEMU received
> > +         * the postcopy messages, it must have received the sync message on
> > +         * the main channel (either RAM_SAVE_FLAG_MULTIFD_FLUSH, or
> > +         * RAM_SAVE_FLAG_EOS), and such message should have guaranteed all
> > +         * previous guest pages queued in the multifd channels to be
> > +         * completely loaded.
> > +         */

* I'll include the above suggested corrections. I'm thinking it might
help more to have such an explanatory comment at the definition of the
multifd_ram_flush_and_sync() routine. Because looking at that function
it is not clear how 'MULTIFD_SYNC_ALL' is used. It sets the
'->pending_sync' to MULTIFD_SYNC_CALL. And when '->pending_sync' is
set this way, multifd_send_thread() writes 'MULTIFD_FLAG_SYNC' on each
multifd channel. At the destination this 'MULTIFD_FLAG_SYNC' flag is
then used to sync main and multifd_recv threads.

...wdyt?

Thank you.
---
  - Prasad


Reply via email to