From: Peter Xu <peterx@redhat.com>
To: Avihai Horon <avihaih@nvidia.com>
Cc: qemu-devel@nongnu.org, "Alex Williamson" <alex@shazbot.org>,
"Cédric Le Goater" <clg@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Maor Gottlieb" <maorg@nvidia.com>
Subject: Re: [PATCH 07/14] migration: Make switchover-ack re-usable
Date: Wed, 27 May 2026 11:38:29 -0400 [thread overview]
Message-ID: <ahcP9dtUqSAc-LAq@x1.local> (raw)
In-Reply-To: <c450e363-22f5-4bf8-9c04-896ccb02938b@nvidia.com>
On Wed, May 27, 2026 at 11:17:45AM +0300, Avihai Horon wrote:
>
> On 5/26/2026 7:23 PM, Peter Xu wrote:
> > External email: Use caution opening links or attachments
> >
> >
> > On Tue, May 26, 2026 at 12:08:34PM +0300, Avihai Horon wrote:
> > > On 5/25/2026 6:01 PM, Peter Xu wrote:
> > > > External email: Use caution opening links or attachments
> > > >
> > > >
> > > > On Sun, May 24, 2026 at 09:34:48AM +0300, Avihai Horon wrote:
> > > > > Yes I think so.
> > > > >
> > > > > We just need to indicate modules that it’s the last query during switchover
> > > > > so they can handle it properly.
> > > > > Do you think it would be reasonable to add a "bool final" param to
> > > > > save_query_pending handler?
> > > > >
> > > > > For RAM it will be used to indicate we are running under the BQL (since
> > > > > currently save_query_pending runs only outside BQL) and to pass the proper
> > > > > last_stage param into migration_bitmap_sync_precopy().
> > > > > For VFIO it will indicate we should not do a query precopy info ioctl (which
> > > > > is only valid in VFIO precopy states, not while VM is stopped).
> > > > Yes, a final boolean sounds reasonable, implying both (1) last sync before
> > > > switchover, VM stopped, (2) BQL held.
> > > >
> > > > For VFIO, I double checked the complete() that does not depend on the
> > > > precopy_bytes fetched, then it should be fine indeed,
> > > >
> > > > vfio_save_complete_precopy():
> > > > do {
> > > > data_size = vfio_save_block(f, vbasedev->migration);
> > > > if (data_size < 0) {
> > > > return data_size;
> > > > }
> > > > } while (data_size);
> > > >
> > > > It's just werid to see that it doesn't depend on either precopy_bytes or
> > > > initial_bytes, even if logically it should.. this will be confusing to
> > > > whoever start reading this code.. but I understand not much we can do with
> > > > the current kernel API.
> > > >
> > > > Side note: should we still better update these fields to make sure they'll
> > > > be zero after migration? That means vfio_update_estimated_pending_data() in
> > > > vfio_save_complete_precopy() too, with/without further sanity checks. That
> > > > seems to be missing right now. I'm not sure if it's intentional.
> > > Yes, it's intentional, since we don't use these values after calling
> > > vfio_save_complete_precopy() -- they are only used for downtime estimation
> > > prior switchover.
> > > Precopy_init/dirty sizes are zeroed in vfio_save_cleanup() though, but not
> > > stopcopy_size (however, that's benign, since upon new migration it will be
> > > reset before used).
> > >
> > > So calling vfio_update_estimated_pending_data() here seems redundant to me.
> > Logically migration can still fail during complete():
> >
> > qemu_savevm_state_complete_precopy():
> > ret = qemu_savevm_state_complete_precopy_iterable(f, false);
> > if (ret) {
> > return ret;
> > }
> >
> > If vfio_update_estimated_pending_data() has the safe guard for any form of
> > overflow, then IMHO we should try to maintain those counters if possible.
>
> Yes, we can call vfio_update_estimated_pending_data() in
> vfio_save_complete_precopy(), but I am not sure I see what's the benefit of
> it?
>
> If it's to ensure these counters are zero post of migration, then even if
> migration fails the .save_cleanup handler will be called and zero them (I
> can add a patch that zeroes stopcopy_size as well).
Nothing critical indeed.
I only wished save_complete() should look almost what save_live_iterate()
looks like. Because they should really do similar things dumping iterable
data.. with some nuances only.
Ideally, if we can add vfio_update_estimated_pending_data() into vfio's
complete() it reduces that gap.
That, including the other thing you plan to do by moving the slow sync out
of RAM's complete(): both of them try to also make complete() look more
like save_live_iterate().
If one day we want to remove save_complete(), it'll also be easier. And
IMO we should consider removing it at some point, passing another "bool
final" to save_live_iterate().
If we see some other save_complete() hooks: htab_save_complete() is almost
a dup of htab_save_iterate() with trivial diff, cmma_save_complete() is
literally cmma_save_iterate() with passing "final" to cmma_save(), etc.
So that's only about making VFIO less special in complete() only. If you
think that's a good future approach we can do that in this series together,
but we can also leave it for later. No strong feelings.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2026-05-27 15:39 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 8:14 [PATCH 00/14] Make switchover-ack re-usable and add VFIO precopy REINIT feature Avihai Horon
2026-05-05 8:14 ` [PATCH 01/14] scripts/update-linux-headers: Add typelimits.h Avihai Horon
2026-05-07 7:54 ` Cédric Le Goater
2026-05-07 9:07 ` gaosong
2026-05-05 8:14 ` [PATCH 02/14] linux-headers: Update to Linux v7.1-rc1 Avihai Horon
2026-05-07 9:16 ` Cédric Le Goater
2026-05-05 8:14 ` [PATCH 03/14] migration: Propagate errors in migration_completion_precopy() Avihai Horon
2026-05-07 8:03 ` Cédric Le Goater
2026-05-08 13:01 ` Avihai Horon
2026-05-15 15:20 ` Peter Xu
2026-05-18 12:02 ` Avihai Horon
2026-05-05 8:14 ` [PATCH 04/14] migration: Log the approver in qemu_loadvm_approve_switchover() Avihai Horon
2026-05-07 8:09 ` Cédric Le Goater
2026-05-08 13:07 ` Avihai Horon
2026-05-15 15:24 ` Peter Xu
2026-05-05 8:14 ` [PATCH 05/14] migration: Replace switchover_ack_needed SaveVMHandler Avihai Horon
2026-05-15 15:27 ` Peter Xu
2026-05-05 8:14 ` [PATCH 06/14] migration: Rename switchover-ack code to legacy Avihai Horon
2026-05-05 8:14 ` [PATCH 07/14] migration: Make switchover-ack re-usable Avihai Horon
2026-05-07 14:10 ` Fabiano Rosas
2026-05-19 19:48 ` Peter Xu
2026-05-21 13:39 ` Avihai Horon
2026-05-21 14:54 ` Peter Xu
2026-05-24 6:34 ` Avihai Horon
2026-05-25 15:01 ` Peter Xu
2026-05-26 9:08 ` Avihai Horon
2026-05-26 16:23 ` Peter Xu
2026-05-27 8:17 ` Avihai Horon
2026-05-27 15:38 ` Peter Xu [this message]
2026-05-28 9:10 ` Avihai Horon
2026-05-28 13:21 ` Peter Xu
2026-05-05 8:14 ` [PATCH 08/14] migration: Check switchover-ack during switchover phase Avihai Horon
2026-05-05 8:14 ` [PATCH 09/14] vfio/migration: Re-query precopy size before sending VFIO_MIG_FLAG_DEV_INIT_DATA_SENT Avihai Horon
2026-05-07 8:24 ` Cédric Le Goater
2026-05-08 13:10 ` Avihai Horon
2026-05-19 19:58 ` Peter Xu
2026-05-21 13:46 ` Avihai Horon
2026-05-21 15:04 ` Peter Xu
2026-05-24 6:45 ` Avihai Horon
2026-05-25 15:19 ` Peter Xu
2026-05-26 9:17 ` Avihai Horon
2026-05-26 17:38 ` Peter Xu
2026-05-05 8:14 ` [PATCH 10/14] vfio/migration: Add Error ** parameter to vfio_migration_init() Avihai Horon
2026-05-07 7:59 ` Cédric Le Goater
2026-05-08 13:18 ` Avihai Horon
2026-05-08 13:21 ` Avihai Horon
2026-05-05 8:14 ` [PATCH 11/14] vfio/migration: Add new switchover-ack mechanism Avihai Horon
2026-05-05 8:14 ` [PATCH 12/14] vfio/migration: Implement VFIO_PRECOPY_INFO_REINIT feature Avihai Horon
2026-05-05 8:14 ` [PATCH 13/14] vfio/migration: Check VFIO_PRECOPY_INFO_REINIT during switchover Avihai Horon
2026-05-05 8:14 ` [PATCH 14/14] migration: Enable new switchover-ack Avihai Horon
2026-05-19 20:11 ` Peter Xu
2026-05-21 14:00 ` Avihai Horon
2026-05-21 15:05 ` Peter Xu
2026-05-19 20:09 ` [PATCH 00/14] Make switchover-ack re-usable and add VFIO precopy REINIT feature Peter Xu
2026-05-21 13:53 ` Avihai Horon
2026-05-21 15:20 ` Peter Xu
2026-05-24 6:58 ` Avihai Horon
2026-05-25 15:15 ` Peter Xu
2026-05-26 9:10 ` Avihai Horon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ahcP9dtUqSAc-LAq@x1.local \
--to=peterx@redhat.com \
--cc=alex@shazbot.org \
--cc=avihaih@nvidia.com \
--cc=clg@redhat.com \
--cc=cohuck@redhat.com \
--cc=farosas@suse.de \
--cc=maorg@nvidia.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.