All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Ben Chaney <bchaney@akamai.com>
Cc: qemu-devel@nongnu.org, "Peter Xu" <peterx@redhat.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Stefano Garzarella" <sgarzare@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Alex Williamson" <alex@shazbot.org>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Eric Blake" <eblake@redhat.com>, "Stefan Weil" <sw@weilnetz.de>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Hamza Khan" <hamza.khan@nutanix.com>,
	"Mark Kanda" <mark.kanda@oracle.com>,
	"Joshua Hunt" <johunt@akamai.com>,
	"Max Tottenham" <mtottenh@akamai.com>,
	"Steve Sistare" <steven.sistare@oracle.com>
Subject: Re: [PATCH v3 6/8] tap: cpr support
Date: Thu, 04 Dec 2025 09:09:10 +0100	[thread overview]
Message-ID: <874iq6mzx5.fsf@pond.sub.org> (raw)
In-Reply-To: <20251203-cpr-tap-v3-6-3c12e0a61f8e@akamai.com> (Ben Chaney's message of "Wed, 03 Dec 2025 13:51:23 -0500")

Ben Chaney <bchaney@akamai.com> writes:

> From: Steve Sistare <steven.sistare@oracle.com>
>
> Provide the cpr=on option to preserve TAP and vhost descriptors during
> cpr-transfer, so the management layer does not need to create a new
> device for the target.
>
> Save all tap fd's in canonical order, leveraging the index argument of
> cpr_save_fd.  For the i'th queue, the tap device fd is saved at index 2*i,
> and the vhostfd (if any) at index 2*i+1.
>
> tap and vhost fd's are passed by name to the monitor when a NIC is hot
> plugged, but the name is not known to qemu after cpr.  Allow the manager
> to pass -1 for the fd "name" in the new qemu args to indicate that QEMU
> should search for a saved value.  Example:
>
>   -netdev tap,id=hostnet2,fds=-1:-1,vhostfds=-1:-1,cpr=on

Hmm.  See below.

>
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> Signed-off-by: Ben Chaney <bchaney@akamai.com>

[...]

> diff --git a/qapi/net.json b/qapi/net.json
> index 118bd34965..264213b5d9 100644
> --- a/qapi/net.json
> +++ b/qapi/net.json
> @@ -355,6 +355,8 @@
   ##
   # @NetdevTapOptions:
   #
   # Used to configure a host TAP network interface backend.
   #
   # @ifname: interface name
   #
   # @fd: file descriptor of an already opened tap
   #
   # @fds: multiple file descriptors of already opened multiqueue capable
   #     tap

Not this patch's fault: the interface is misguided, and its
documentation inadequate.

@fds is a string of file descriptor names or numbers separated by ':'.
Not documented.  I found out by reading the code.

This violates QAPI design principle "no string parsing".  It should be
an array of strings.

Aside: get_fds() should use g_strsplit().

Your patch extends the syntax to "file descriptor names or numbers or
"-1" separated by ":".  This is problematic.

Before the patch, a file descriptor name or number is interpreted as a
file descriptor number if it starts with a digit.  "-1" doesn't, so it's
interpreted as a file descriptor name.  Yes, "-1" works as file
descriptor name.  I just verified that

    {"execute": "getfd", "arguments": {"fdname": "-1"}}

works by changing 'fdname': 'fdname' to 'fdname': '-1' in
tests/qtest/libqtest.c, and running tests/qtest/dbus-display-test with
QTEST_LOG=/dev/stdout.  The test passes using file descriptor name "-1".

Aside: not restricting the syntax of identifiers to something sensible
like "begin with a letter, and contain only ASCII letters, digits, and
hyphen" is a mistake we've make again and again.

Your patch changes the interpretation of "-1" from "file descriptor
name" to "saved file descriptor".

If it does so regardless of the value of @cpr, then this is an
incompatible change.

We normally require such changes to go through the deprecation process.
We waive that when we're *confident* not doing so will not inconvenience
any users.  Are we here?

If it does so only when @cpr is true, the semantics of "-1" depends on
@cpr.  Yuck!

We can accept "yuck!" when the alternatives are no better.  Have we
considered any?

Regardless, we clearly need to document syntax and semantics of @fds.
Please fix the doc string before this patch, then have this patch update
it.

   #
   # @script: script to initialize the interface
   #
   # @downscript: script to shut down the interface
   #
   # @br: bridge name (since 2.8)
   #
   # @helper: command to execute to configure bridge
   #
   # @sndbuf: send buffer limit.  Understands [TGMKkb] suffixes.
   #
   # @vnet_hdr: enable the IFF_VNET_HDR flag on the tap interface
   #
   # @vhost: enable vhost-net network accelerator
   #
   # @vhostfd: file descriptor of an already opened vhost net device
   #
   # @vhostfds: file descriptors of multiple already opened vhost net
   #     devices

Likewise.

   #
   # @vhostforce: vhost on for non-MSIX virtio guests
   #
   # @queues: number of queues to be created for multiqueue capable tap
   #
>  # @poll-us: maximum number of microseconds that could be spent on busy
>  #     polling for tap (since 2.7)
>  #
> +# @cpr: preserve fds and vhostfds during cpr-transfer.

The commit message explains things in a lot more detail.  Users may not
need to know all that detail.  But this feels too terse.

Please don't abbreviate "file descriptors" to "fds" in documentation
prose.

> +#
>  # Since: 1.2
>  ##
>  { 'struct': 'NetdevTapOptions',
> @@ -373,7 +375,8 @@
     'data': {
       '*ifname':     'str',
       '*fd':         'str',
       '*fds':        'str',
       '*script':     'str',
       '*downscript': 'str',
       '*br':         'str',
       '*helper':     'str',
       '*sndbuf':     'size',
       '*vnet_hdr':   'bool',
       '*vhost':      'bool',
       '*vhostfd':    'str',
>      '*vhostfds':   'str',
>      '*vhostforce': 'bool',
>      '*queues':     'uint32',
> -    '*poll-us':    'uint32'} }
> +    '*poll-us':    'uint32',
> +    '*cpr':        'bool'} }
>  
>  ##
>  # @NetdevSocketOptions:



  reply	other threads:[~2025-12-04  8:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03 18:51 [PATCH v3 0/8] Live update: tap and vhost Ben Chaney
2025-12-03 18:51 ` [PATCH v3 1/8] migration: stop vm earlier for cpr Ben Chaney
2025-12-03 18:51 ` [PATCH v3 2/8] migration: cpr setup notifier Ben Chaney
2025-12-03 18:51 ` [PATCH v3 3/8] vhost: reset vhost devices for cpr Ben Chaney
2025-12-03 18:51 ` [PATCH v3 4/8] cpr: delete all fds Ben Chaney
2025-12-03 18:51 ` [PATCH v3 5/8] tap: common return label Ben Chaney
2025-12-03 18:51 ` [PATCH v3 6/8] tap: cpr support Ben Chaney
2025-12-04  8:09   ` Markus Armbruster [this message]
2025-12-05  0:51     ` Jason Wang
2025-12-05  6:46       ` Markus Armbruster
2025-12-04 17:46   ` Cédric Le Goater
2025-12-04 17:56   ` Daniel P. Berrangé
2025-12-03 18:51 ` [PATCH v3 7/8] tap: postload fix for cpr Ben Chaney
2025-12-03 18:51 ` [PATCH v3 8/8] tap: cpr fixes Ben Chaney
2025-12-04 17:59   ` Daniel P. Berrangé
2025-12-04 12:52 ` [PATCH v3 0/8] Live update: tap and vhost Vladimir Sementsov-Ogievskiy
2025-12-08 21:03   ` Chaney, Ben
2025-12-09  7:27     ` Vladimir Sementsov-Ogievskiy
2025-12-08 10:08 ` Cédric Le Goater
2025-12-08 14:22   ` Mark Kanda
2025-12-08 14:42     ` Cédric Le Goater
2025-12-09 18:36   ` Chaney, Ben
  -- strict thread matches above, loose matches on Subject: below --
2025-12-03 18:43 Ben Chaney
2025-12-03 18:43 ` [PATCH v3 6/8] tap: cpr support Ben Chaney

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=874iq6mzx5.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex@shazbot.org \
    --cc=bchaney@akamai.com \
    --cc=berrange@redhat.com \
    --cc=clg@redhat.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=hamza.khan@nutanix.com \
    --cc=jasowang@redhat.com \
    --cc=johunt@akamai.com \
    --cc=mark.kanda@oracle.com \
    --cc=mst@redhat.com \
    --cc=mtottenh@akamai.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=steven.sistare@oracle.com \
    --cc=sw@weilnetz.de \
    /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.