From: Peter Xu <peterx@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: jasowang@redhat.com, qemu-devel@nongnu.org, leiyang@redhat.com,
steven.sistare@oracle.com, yc-core@yandex-team.ru,
mst@redhat.com, farosas@suse.de, eblake@redhat.com,
armbru@redhat.com, thuth@redhat.com, philmd@linaro.org,
berrange@redhat.com
Subject: Re: [PATCH v3 4/9] qapi: add interface for local TAP migration
Date: Mon, 8 Sep 2025 14:47:21 -0400 [thread overview]
Message-ID: <aL8kuXQ2JF1TV3M7@x1.local> (raw)
In-Reply-To: <2626fb74-a8f4-475b-ab01-3b20c6ff2ae2@yandex-team.ru>
On Mon, Sep 08, 2025 at 07:38:45PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> On 08.09.25 18:35, Peter Xu wrote:
> > On Fri, Sep 05, 2025 at 04:50:34PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> > > diff --git a/qapi/migration.json b/qapi/migration.json
> > > index 2387c21e9c..992a5b1e2b 100644
> > > --- a/qapi/migration.json
> > > +++ b/qapi/migration.json
> > > @@ -517,6 +517,12 @@
> > > # each RAM page. Requires a migration URI that supports seeking,
> > > # such as a file. (since 9.0)
> > > #
> > > +# @local-tap: Migrate TAPs locally, keeping backend alive. Open file
> > > +# descriptors and TAP-related state are migrated. Only may be
> > > +# used when migration channel is unix socket. For target device
> > > +# also @local-incoming option must be specified (since 10.2)
> > > +# (since 10.2)
> >
> > IMHO we should move this into a per-device property, at least we need one
> > there to still control the device behavior; we had a similar discussion
> > recently on iterable virtio-net.
> >
> > But maybe this one is slightly special? Maybe the tap device needs to at
> > least know whether in this specific migration, if we want to pass over FD
> > or not (e.g. local upgrade, or remote _real_ migration)?
> >
> > If that's the case, we may consider providing a generic migration
> > capability, like cap-fd-passing. Nowadays since Fabiano's moving migration
> > capabilities all over to migration parameters, this one can start with a
> > parameter instead of a capability. The problem with migration capability
> > is (at least) that it can't by default ON on any machine types.. meanwhile
> > it simply looks like identital to parameters except it's always bool.
> >
> > The high level rational is that we should never add a per-device cap flag
> > into migration framework.
> >
>
> Hmm.
>
> 1. Yes, we need to distinguish, is that _real_ migration or local. And setting a
> special property for each device (which supports fd-migration) to turn on passing
> FD to the channel seems not comfortable and error prune.
>
> 2. Initially, I decided separate "local-tap" and "local-vhost-user-blk" capabilities
> just to simplify further testing/debugging in real environment: the possibility to
> enable only "half of magic" helps.
>
> So, granularity makes sence, but having local-XXX capability for each device class
> looks bad.
>
> Maybe, having generic cap-fd-passing, together with possibility to disable it on
> per-device basis (like migrate-fd=false) is good compromise.
>
>
> Another question is, do we need "local-incoming" option for target device.
>
> Initially I added this because I thought: ho, I need to distinguish it initialization
> time: do I need to call open(), or wait for incoming fd.
>
> Now I see that I can just postpone this decision up to "start" point, where
>
> - either I already have fd from incoming migration
> - or have nothing: in this case, let's call open()
>
> -
>
> I'll try to go with one "fd-passing" capability, as any kind of granularity may be
> added later on demand.
>
>
> Hmm2. Probably we can avoid even adding such a capability, but just check, is migration
> channel support fd passing or not? Seems too implicit for me.
If we want to expose a feature internally, IIUC we can use QAPI "features"
like this:
https://lore.kernel.org/all/20250603013810.4772-17-farosas@suse.de/
But I'm not yet sure whether it's useful..
In this case the "capability" itself should almost always be present when
using unix sockets.. The problem is, IIUC we're not trying to describe a
capability, but a choice the user made.
For example, when unix socket is the transport, we can still decide to not
use fd passing even if it's fully supported in the current QEMU binary for
any devices that are involved, because any of: (1) it could be a unix
socket to a proxy daemon (of a container?) when fd passing isn't supported
in the daemon, or (2) as you mentioned above, for debugging purpose when we
want to triage whether a bug is relevant to fd-passing. Maybe more.
The per-device granularity you mentioned also makes sense to me.
An use case is when, imagine, we have a QEMU that (1) supports tap local
migration, but (2) doesn't yet support virtio-blk local migration. Then we
want to be able to enable the fd-passing for tap/virtio-net, but not for
virtio-blk (even if the src QEMU in the context might support both)?
IOW, it makes sense to me to have two layers of controls here:
(a) Migration new parameter, "migrate-fds" (or any better name..).
When set, it enables all devices that supports fd-passing to migrate
the fds directly. OTOH, when not set, even if all devices enabled
fd-passing, it should still do a full migration. This one is the
user knob saying "I want to migrate with fd migrated".
This should imply unix sockets for sure as the transport, and should
fail upfront if it's not a unix socket.
We should also auto-select this with cpr migrations.. then in any
code path (whenever such path exists?) that the fds can be either
migrated from cpr or main channels.
(b) Device new parameter, "migrate-fds" (or any better name..).
When set, the device will declare support migrating fds "whenever the
migration applies", aka, when above (a) is selected first.
Taking tap device as example here, setting it ON here means "please
enable fd-passing whenever the user enables this migration option".
So in tap code, it should migrate fd if both (a) and (b) are ON.
When migrating to e.g. old QEMUs, here (b) should be OFF even if (a)
is ON.
Would above make sense?
--
Peter Xu
next prev parent reply other threads:[~2025-09-08 18:49 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 13:50 [PATCH v3 0/9] virtio-net: live-TAP local migration Vladimir Sementsov-Ogievskiy
2025-09-05 13:50 ` [PATCH v3 1/9] net/tap: add some trace points Vladimir Sementsov-Ogievskiy
2025-09-05 13:50 ` [PATCH v3 2/9] net/tap: keep exit notifier only when downscript set Vladimir Sementsov-Ogievskiy
2025-09-05 13:50 ` [PATCH v3 3/9] net/tap: refactor net_tap_setup_vhost() Vladimir Sementsov-Ogievskiy
2025-09-05 13:50 ` [PATCH v3 4/9] qapi: add interface for local TAP migration Vladimir Sementsov-Ogievskiy
2025-09-08 15:35 ` Peter Xu
2025-09-08 16:38 ` Vladimir Sementsov-Ogievskiy
2025-09-08 18:47 ` Peter Xu [this message]
2025-09-09 7:40 ` Vladimir Sementsov-Ogievskiy
2025-09-05 13:50 ` [PATCH v3 5/9] net/tap: implement interfaces for local migration Vladimir Sementsov-Ogievskiy
2025-09-08 15:42 ` Peter Xu
2025-09-08 16:48 ` Vladimir Sementsov-Ogievskiy
2025-09-08 20:01 ` Peter Xu
2025-09-09 7:44 ` Vladimir Sementsov-Ogievskiy
2025-09-09 14:56 ` Peter Xu
2025-09-09 15:08 ` Vladimir Sementsov-Ogievskiy
2025-09-05 13:50 ` [PATCH v3 6/9] virtio-net: support local tap migration Vladimir Sementsov-Ogievskiy
2025-09-08 15:43 ` Peter Xu
2025-09-08 16:48 ` Vladimir Sementsov-Ogievskiy
2025-09-05 13:50 ` [PATCH v3 7/9] tests/functional: exec_command_and_wait_for_pattern: add vm arg Vladimir Sementsov-Ogievskiy
2025-09-09 14:03 ` Thomas Huth
2025-09-09 14:09 ` Vladimir Sementsov-Ogievskiy
2025-09-05 13:50 ` [PATCH v3 8/9] tests/functional: add skipUnlessPasswordlessSudo() decorator Vladimir Sementsov-Ogievskiy
2025-09-08 15:49 ` Daniel P. Berrangé
2025-09-05 13:50 ` [PATCH v3 9/9] tests/functional: add test_x86_64_tap_fd_migration Vladimir Sementsov-Ogievskiy
2025-09-08 15:58 ` Daniel P. Berrangé
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=aL8kuXQ2JF1TV3M7@x1.local \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=jasowang@redhat.com \
--cc=leiyang@redhat.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.com \
--cc=thuth@redhat.com \
--cc=vsementsov@yandex-team.ru \
--cc=yc-core@yandex-team.ru \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).