[PATCH v5] qapi: net: deprecate vhostforce option

Vladimir Sementsov-Ogievskiy posted 1 patch 2 weeks, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251028152400.45938-1-vsementsov@yandex-team.ru
Maintainers: Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Jason Wang <jasowang@redhat.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
docs/about/deprecated.rst     | 11 +++++++++++
qapi/net.json                 | 18 ++++++++++++++----
qemu-options.hx               | 13 +++++--------
tests/qtest/vhost-user-test.c |  2 +-
4 files changed, 31 insertions(+), 13 deletions(-)
[PATCH v5] qapi: net: deprecate vhostforce option
Posted by Vladimir Sementsov-Ogievskiy 2 weeks, 3 days ago
This option for tap and vhost-user netdevs doesn't make sense
since long ago (10 years!), starting from commits:

 1e7398a140f7a6 ("vhost: enable vhost without without MSI-X")
 24f938a682d934 ("vhost user:support vhost user nic for non msi guests")

Prior these commits, to enable kernel vhost-net, or vhost-user-net for
some specific kind of guests (that don't have MSI-X support), you should
have set vhostforce=on.

Now guest type doesn't matter, all guests are equal for these
options logic.

For tap the current logic is:
  vhost=on / vhost=off : vhostforce ignored, doesn't make sense
  vhost unset : vhostforce counts, enabling vhost

So you may enable vhost for tap several ways:
- vhost=on
- vhostforce=on
- vhost=on + vhostforce=on
- and even vhost=on + vhostforce=off

- they are all equal.

For vhost-user we simply ignore the vhostforce option at all in the
code.

Let's finally deprecate the extra options.

Also, fix @vhostforce documentation everywhere to show the real picture,
and update vhost-user test to not use deprecated option.

While updating command line options, drop "experimental" word from
"experimental in kernel accelerator". vhost-net is in production for
years.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---

v5: update wording and commit message

 docs/about/deprecated.rst     | 11 +++++++++++
 qapi/net.json                 | 18 ++++++++++++++----
 qemu-options.hx               | 13 +++++--------
 tests/qtest/vhost-user-test.c |  2 +-
 4 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index dacf2882e4..a781600a2f 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -484,6 +484,17 @@ Stream ``reconnect`` (since 9.2)
 The ``reconnect`` option only allows specifying second granularity timeouts,
 which is not enough for all types of use cases, use ``reconnect-ms`` instead.
 
+TAP ``vhostforce`` (since 10.2)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The ``vhostforce`` option is redundant with the ``vhost`` option.
+If they conflict, ``vhost`` takes precedence.  Just use ``vhost``.
+
+Vhost-user ``vhostforce`` (since 10.2)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The ``vhostforce`` option is a no-op.  Do not use it.
+
 CPU device properties
 '''''''''''''''''''''
 
diff --git a/qapi/net.json b/qapi/net.json
index 60d196afe5..e8ccc8afc2 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -346,13 +346,18 @@
 # @vhostfds: file descriptors of multiple already opened vhost net
 #     devices
 #
-# @vhostforce: vhost on for non-MSIX virtio guests
+# @vhostforce: enable vhost-net network accelerator.  Ignored when
+#    @vhost is set.
 #
 # @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)
 #
+# Features:
+#
+# @deprecated: Member @vhostforce is deprecated.  Use @vhost instead.
+#
 # Since: 1.2
 ##
 { 'struct': 'NetdevTapOptions',
@@ -369,7 +374,7 @@
     '*vhost':      'bool',
     '*vhostfd':    'str',
     '*vhostfds':   'str',
-    '*vhostforce': 'bool',
+    '*vhostforce': { 'type': 'bool', 'features': [ 'deprecated' ] },
     '*queues':     'uint32',
     '*poll-us':    'uint32'} }
 
@@ -606,17 +611,22 @@
 #
 # @chardev: name of a unix socket chardev
 #
-# @vhostforce: vhost on for non-MSIX virtio guests (default: false).
+# @vhostforce: silently ignored, exists just for backward
+#     compatibility.
 #
 # @queues: number of queues to be created for multiqueue vhost-user
 #     (default: 1) (Since 2.5)
 #
+# Features:
+#
+# @deprecated: Member @vhostforce is deprecated.
+#
 # Since: 2.1
 ##
 { 'struct': 'NetdevVhostUserOptions',
   'data': {
     'chardev':        'str',
-    '*vhostforce':    'bool',
+    '*vhostforce': { 'type': 'bool', 'features': [ 'deprecated' ] },
     '*queues':        'int' } }
 
 ##
diff --git a/qemu-options.hx b/qemu-options.hx
index 0223ceffeb..35a70096e8 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2882,7 +2882,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
 #else
     "-netdev tap,id=str[,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile]\n"
     "         [,br=bridge][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off]\n"
-    "         [,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]\n"
+    "         [,vhostfd=h][,vhostfds=x:y:...:z][,queues=n]\n"
     "         [,poll-us=n]\n"
     "                configure a host TAP network backend with ID 'str'\n"
     "                connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
@@ -2898,9 +2898,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
     "                default is disabled 'sndbuf=0' to enable flow control set 'sndbuf=1048576')\n"
     "                use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag\n"
     "                use vnet_hdr=on to make the lack of IFF_VNET_HDR support an error condition\n"
-    "                use vhost=on to enable experimental in kernel accelerator\n"
-    "                    (only has effect for virtio guests which use MSIX)\n"
-    "                use vhostforce=on to force vhost on for non-MSIX virtio guests\n"
+    "                use vhost=on to enable in kernel accelerator\n"
     "                use 'vhostfd=h' to connect to an already opened vhost net device\n"
     "                use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n"
     "                use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n"
@@ -2991,7 +2989,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
     "                use 'start-queue=m' to specify the first queue that should be used\n"
 #endif
 #ifdef CONFIG_POSIX
-    "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n"
+    "-netdev vhost-user,id=str,chardev=dev\n"
     "                configure a vhost-user network, backed by a chardev 'dev'\n"
 #endif
 #ifdef __linux__
@@ -3882,12 +3880,11 @@ SRST
     for insertion into the socket map.  The combination of 'map-path' and
     'sock-fds' together is not supported.
 
-``-netdev vhost-user,chardev=id[,vhostforce=on|off][,queues=n]``
+``-netdev vhost-user,chardev=id[,queues=n]``
     Establish a vhost-user netdev, backed by a chardev id. The chardev
     should be a unix domain socket backed one. The vhost-user uses a
     specifically defined protocol to pass vhost ioctl replacement
-    messages to an application on the other end of the socket. On
-    non-MSIX guests, the feature can be forced with vhostforce. Use
+    messages to an application on the other end of the socket. Use
     'queues=n' to specify the number of queues to be created for
     multiqueue vhost-user.
 
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 609ff24059..a4862d7087 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -46,7 +46,7 @@
 #define QEMU_CMD_SHM    " -m %d -object memory-backend-shm,id=mem,size=%dM," \
                         " -numa node,memdev=mem"
 #define QEMU_CMD_CHR    " -chardev socket,id=%s,path=%s%s"
-#define QEMU_CMD_NETDEV " -netdev vhost-user,id=hs0,chardev=%s,vhostforce=on"
+#define QEMU_CMD_NETDEV " -netdev vhost-user,id=hs0,chardev=%s"
 
 #define HUGETLBFS_MAGIC       0x958458f6
 
-- 
2.48.1
Re: [PATCH v5] qapi: net: deprecate vhostforce option
Posted by Vladimir Sementsov-Ogievskiy 1 day, 9 hours ago
ping

Could this still be taken to 10.2? Or I have to resend with 11.0 numbers?

On 28.10.25 18:23, Vladimir Sementsov-Ogievskiy wrote:
> This option for tap and vhost-user netdevs doesn't make sense
> since long ago (10 years!), starting from commits:
> 
>   1e7398a140f7a6 ("vhost: enable vhost without without MSI-X")
>   24f938a682d934 ("vhost user:support vhost user nic for non msi guests")
> 
> Prior these commits, to enable kernel vhost-net, or vhost-user-net for
> some specific kind of guests (that don't have MSI-X support), you should
> have set vhostforce=on.
> 
> Now guest type doesn't matter, all guests are equal for these
> options logic.
> 
> For tap the current logic is:
>    vhost=on / vhost=off : vhostforce ignored, doesn't make sense
>    vhost unset : vhostforce counts, enabling vhost
> 
> So you may enable vhost for tap several ways:
> - vhost=on
> - vhostforce=on
> - vhost=on + vhostforce=on
> - and even vhost=on + vhostforce=off
> 
> - they are all equal.
> 
> For vhost-user we simply ignore the vhostforce option at all in the
> code.
> 
> Let's finally deprecate the extra options.
> 
> Also, fix @vhostforce documentation everywhere to show the real picture,
> and update vhost-user test to not use deprecated option.
> 
> While updating command line options, drop "experimental" word from
> "experimental in kernel accelerator". vhost-net is in production for
> years.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy<vsementsov@yandex-team.ru>


-- 
Best regards,
Vladimir
Re: [PATCH v5] qapi: net: deprecate vhostforce option
Posted by Jason Wang via Devel 1 day, 9 hours ago
On Thu, Nov 13, 2025 at 3:01 PM Vladimir Sementsov-Ogievskiy
<vsementsov@yandex-team.ru> wrote:
>
> ping
>
> Could this still be taken to 10.2?

Unfortunately it misses the freeze.

> Or I have to resend with 11.0 numbers?
>

Please resend it with 11.0 numbers then I can queue it.

Thanks
Re: [PATCH v5] qapi: net: deprecate vhostforce option
Posted by Markus Armbruster via Devel 2 weeks, 1 day ago
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:

> This option for tap and vhost-user netdevs doesn't make sense
> since long ago (10 years!), starting from commits:
>
>  1e7398a140f7a6 ("vhost: enable vhost without without MSI-X")
>  24f938a682d934 ("vhost user:support vhost user nic for non msi guests")
>
> Prior these commits, to enable kernel vhost-net, or vhost-user-net for
> some specific kind of guests (that don't have MSI-X support), you should
> have set vhostforce=on.
>
> Now guest type doesn't matter, all guests are equal for these
> options logic.
>
> For tap the current logic is:
>   vhost=on / vhost=off : vhostforce ignored, doesn't make sense
>   vhost unset : vhostforce counts, enabling vhost
>
> So you may enable vhost for tap several ways:
> - vhost=on
> - vhostforce=on
> - vhost=on + vhostforce=on
> - and even vhost=on + vhostforce=off
>
> - they are all equal.
>
> For vhost-user we simply ignore the vhostforce option at all in the
> code.
>
> Let's finally deprecate the extra options.
>
> Also, fix @vhostforce documentation everywhere to show the real picture,
> and update vhost-user test to not use deprecated option.
>
> While updating command line options, drop "experimental" word from
> "experimental in kernel accelerator". vhost-net is in production for
> years.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

Reviewed-by: Markus Armbruster <armbru@redhat.com>