[PATCH RFC v2 00/13] virtio: introduce support for GSO over UDP tunnel

Paolo Abeni posted 13 patches 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/cover.1752229731.git.pabeni@redhat.com
Maintainers: Dmitry Fleytman <dmitry.fleytman@gmail.com>, Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>, Jason Wang <jasowang@redhat.com>, Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>, "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Luigi Rizzo <rizzo@iet.unipi.it>, Giuseppe Lettieri <g.lettieri@iet.unipi.it>, Vincenzo Maffione <v.maffione@gmail.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>
There is a newer version of this series
hw/net/e1000e_core.c                         |   5 +-
hw/net/igb_core.c                            |   5 +-
hw/net/vhost_net-stub.c                      |   8 +-
hw/net/vhost_net.c                           |  50 +++--
hw/net/virtio-net.c                          | 215 +++++++++++++------
hw/net/vmxnet3.c                             |  13 +-
hw/virtio/vhost-backend.c                    |  62 +++++-
hw/virtio/vhost.c                            |  73 ++++++-
hw/virtio/virtio-bus.c                       |  11 +-
hw/virtio/virtio-hmp-cmds.c                  |   3 +-
hw/virtio/virtio-pci.c                       | 101 ++++++++-
hw/virtio/virtio-qmp.c                       |  89 +++++---
hw/virtio/virtio-qmp.h                       |   3 +-
hw/virtio/virtio.c                           | 111 ++++++++--
include/hw/virtio/vhost-backend.h            |   6 +
include/hw/virtio/vhost.h                    |  36 +++-
include/hw/virtio/virtio-features.h          | 124 +++++++++++
include/hw/virtio/virtio-net.h               |   2 +-
include/hw/virtio/virtio-pci.h               |   6 +-
include/hw/virtio/virtio.h                   |  11 +-
include/net/net.h                            |  20 +-
include/net/vhost_net.h                      |  33 ++-
include/standard-headers/linux/ethtool.h     |   4 +-
include/standard-headers/linux/vhost_types.h |   5 +
include/standard-headers/linux/virtio_net.h  |  33 +++
linux-headers/asm-x86/kvm.h                  |   8 +-
linux-headers/linux/kvm.h                    |   4 +
linux-headers/linux/vhost.h                  |   7 +
net/net.c                                    |  17 +-
net/netmap.c                                 |   3 +-
net/tap-bsd.c                                |   8 +-
net/tap-linux.c                              |  38 +++-
net/tap-linux.h                              |   9 +
net/tap-solaris.c                            |   9 +-
net/tap-stub.c                               |   8 +-
net/tap.c                                    |  19 +-
net/tap_int.h                                |   5 +-
qapi/virtio.json                             |   8 +-
38 files changed, 945 insertions(+), 227 deletions(-)
create mode 100644 include/hw/virtio/virtio-features.h
[PATCH RFC v2 00/13] virtio: introduce support for GSO over UDP tunnel
Posted by Paolo Abeni 5 months ago
Some virtualized deployments use UDP tunnel pervasively and are impacted
negatively by the lack of GSO support for such kind of traffic in the
virtual NIC driver.

The virtio_net specification recently introduced support for GSO over
UDP tunnel, and the kernel side of the implementation has been merged
into the net-next tree; this series updates the virtio implementation to
support such a feature.

Currently the qemu virtio support limits the feature space to 64 bits,
while the virtio specification allows for a larger number of features.
Specifically the GSO-over-UDP-tunnel-related virtio features use bits
65-69; the larger part of this series (patches 3-11) actually deals with
extending the features space.

The extended features are carried by fixed size uint64_t arrays,
bringing the current maximum features number to 128.

The patches use some syntactic sugar to try to minimize the otherwise
very large code churn. Specifically the extended features are boundled
in an union with 'legacy' features definition, allowing no changes in
the virtio devices not needing the extended features set.

The actual offload implementation is in patches 12 and 13 and boils down
to propagating the new offload to the tun devices and the vhost backend.

Finally patch 1 is a small pre-req refactor that ideally could enter the
tree separately; it's presented here in the same series to help
reviewers more easily getting the full picture and patch 2 is a needed
linux headers update.

Tested with basic stream transfer with all the possible permutations of
host kernel/qemu/guest kernel with/without GSO over UDP tunnel support,
vs snapshots creation and restore and vs migration.

Sharing again as RFC as the kernel bits have not entered the Linus tree
yet - but they should on next merge window.

Paolo Abeni (13):
  net: bundle all offloads in a single struct
  linux-headers: Update to Linux ~v6.16-rc5 net-next
  virtio: introduce extended features type
  virtio: serialize extended features state
  virtio: add support for negotiating extended features
  virtio-pci: implement support for extended features
  vhost: add support for negotiating extended features
  qmp: update virtio features map to support extended features
  vhost-backend: implement extended features support
  vhost-net: implement extended features support
  virtio-net: implement extended features support
  net: implement tunnel probing
  net: implement UDP tunnel features offloading

 hw/net/e1000e_core.c                         |   5 +-
 hw/net/igb_core.c                            |   5 +-
 hw/net/vhost_net-stub.c                      |   8 +-
 hw/net/vhost_net.c                           |  50 +++--
 hw/net/virtio-net.c                          | 215 +++++++++++++------
 hw/net/vmxnet3.c                             |  13 +-
 hw/virtio/vhost-backend.c                    |  62 +++++-
 hw/virtio/vhost.c                            |  73 ++++++-
 hw/virtio/virtio-bus.c                       |  11 +-
 hw/virtio/virtio-hmp-cmds.c                  |   3 +-
 hw/virtio/virtio-pci.c                       | 101 ++++++++-
 hw/virtio/virtio-qmp.c                       |  89 +++++---
 hw/virtio/virtio-qmp.h                       |   3 +-
 hw/virtio/virtio.c                           | 111 ++++++++--
 include/hw/virtio/vhost-backend.h            |   6 +
 include/hw/virtio/vhost.h                    |  36 +++-
 include/hw/virtio/virtio-features.h          | 124 +++++++++++
 include/hw/virtio/virtio-net.h               |   2 +-
 include/hw/virtio/virtio-pci.h               |   6 +-
 include/hw/virtio/virtio.h                   |  11 +-
 include/net/net.h                            |  20 +-
 include/net/vhost_net.h                      |  33 ++-
 include/standard-headers/linux/ethtool.h     |   4 +-
 include/standard-headers/linux/vhost_types.h |   5 +
 include/standard-headers/linux/virtio_net.h  |  33 +++
 linux-headers/asm-x86/kvm.h                  |   8 +-
 linux-headers/linux/kvm.h                    |   4 +
 linux-headers/linux/vhost.h                  |   7 +
 net/net.c                                    |  17 +-
 net/netmap.c                                 |   3 +-
 net/tap-bsd.c                                |   8 +-
 net/tap-linux.c                              |  38 +++-
 net/tap-linux.h                              |   9 +
 net/tap-solaris.c                            |   9 +-
 net/tap-stub.c                               |   8 +-
 net/tap.c                                    |  19 +-
 net/tap_int.h                                |   5 +-
 qapi/virtio.json                             |   8 +-
 38 files changed, 945 insertions(+), 227 deletions(-)
 create mode 100644 include/hw/virtio/virtio-features.h

--
2.50.0
Re: [PATCH RFC v2 00/13] virtio: introduce support for GSO over UDP tunnel
Posted by Lei Yang 5 months ago
Hi Paolo

Does the compile of this series of patches require support for a
special kernel environment? I hit a compile issue after applied you
patches:
[1440/2928] Compiling C object libsystem.a.p/hw_virtio_vhost.c.o
FAILED: libsystem.a.p/hw_virtio_vhost.c.o
cc -m64 -Ilibsystem.a.p -I. -I.. -Isubprojects/dtc/libfdt
-I../subprojects/dtc/libfdt -Isubprojects/libvduse
-I../subprojects/libvduse -Iui -Iqapi -Itrace -Iui/shader
-I/usr/include/pixman-1 -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include -I/usr/include/libmount
-I/usr/include/blkid -I/usr/include/sysprof-6
-I/usr/include/gio-unix-2.0 -I/usr/include/slirp
-fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g
-fstack-protector-strong -Wempty-body -Wendif-labels
-Wexpansion-to-defined -Wformat-security -Wformat-y2k
-Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self
-Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs
-Wold-style-declaration -Wold-style-definition -Wredundant-decls
-Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla
-Wwrite-strings -Wno-missing-include-dirs -Wno-psabi
-Wno-shift-negative-value -isystem
/mnt/tests/distribution/command/qemu/linux-headers -isystem
linux-headers -iquote . -iquote /mnt/tests/distribution/command/qemu
-iquote /mnt/tests/distribution/command/qemu/include -iquote
/mnt/tests/distribution/command/qemu/host/include/x86_64 -iquote
/mnt/tests/distribution/command/qemu/host/include/generic -iquote
/mnt/tests/distribution/command/qemu/tcg/i386 -pthread -mcx16 -msse2
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
-fzero-call-used-regs=used-gpr -fPIE -DWITH_GZFILEOP -DCONFIG_SOFTMMU
-DCOMPILING_SYSTEM_VS_USER -MD -MQ libsystem.a.p/hw_virtio_vhost.c.o
-MF libsystem.a.p/hw_virtio_vhost.c.o.d -o
libsystem.a.p/hw_virtio_vhost.c.o -c ../hw/virtio/vhost.c
../hw/virtio/vhost.c: In function ‘vhost_dev_set_features’:
../hw/virtio/vhost.c:38:9: error: ‘r’ may be used uninitialized
[-Werror=maybe-uninitialized]
   38 |         error_report(fmt ": %s (%d)", ## __VA_ARGS__, \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   39 |                      strerror(-retval), -retval); \
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/virtio/vhost.c:1006:9: note: in expansion of macro ‘VHOST_OPS_DEBUG’
 1006 |         VHOST_OPS_DEBUG(r, "extended features without device support");
      |         ^~~~~~~~~~~~~~~
../hw/virtio/vhost.c:989:9: note: ‘r’ was declared here
  989 |     int r;
      |         ^
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:168: run-ninja] Error 1
make[1]: Leaving directory '/mnt/tests/distribution/command/qemu/build'
make[1]: Entering directory '/mnt/tests/distribution/command/qemu/build'
[1/1493] Generating subprojects/dtc/version_gen.h with a custom command
[2/1493] Generating qemu-version.h with a custom command (wrapped by
meson to capture output)
[3/1492] Compiling C object libsystem.a.p/hw_virtio_vhost.c.o
FAILED: libsystem.a.p/hw_virtio_vhost.c.o
cc -m64 -Ilibsystem.a.p -I. -I.. -Isubprojects/dtc/libfdt
-I../subprojects/dtc/libfdt -Isubprojects/libvduse
-I../subprojects/libvduse -Iui -Iqapi -Itrace -Iui/shader
-I/usr/include/pixman-1 -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include -I/usr/include/libmount
-I/usr/include/blkid -I/usr/include/sysprof-6
-I/usr/include/gio-unix-2.0 -I/usr/include/slirp
-fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g
-fstack-protector-strong -Wempty-body -Wendif-labels
-Wexpansion-to-defined -Wformat-security -Wformat-y2k
-Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self
-Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs
-Wold-style-declaration -Wold-style-definition -Wredundant-decls
-Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla
-Wwrite-strings -Wno-missing-include-dirs -Wno-psabi
-Wno-shift-negative-value -isystem
/mnt/tests/distribution/command/qemu/linux-headers -isystem
linux-headers -iquote . -iquote /mnt/tests/distribution/command/qemu
-iquote /mnt/tests/distribution/command/qemu/include -iquote
/mnt/tests/distribution/command/qemu/host/include/x86_64 -iquote
/mnt/tests/distribution/command/qemu/host/include/generic -iquote
/mnt/tests/distribution/command/qemu/tcg/i386 -pthread -mcx16 -msse2
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
-fzero-call-used-regs=used-gpr -fPIE -DWITH_GZFILEOP -DCONFIG_SOFTMMU
-DCOMPILING_SYSTEM_VS_USER -MD -MQ libsystem.a.p/hw_virtio_vhost.c.o
-MF libsystem.a.p/hw_virtio_vhost.c.o.d -o
libsystem.a.p/hw_virtio_vhost.c.o -c ../hw/virtio/vhost.c
../hw/virtio/vhost.c: In function ‘vhost_dev_set_features’:
../hw/virtio/vhost.c:38:9: error: ‘r’ may be used uninitialized
[-Werror=maybe-uninitialized]
   38 |         error_report(fmt ": %s (%d)", ## __VA_ARGS__, \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   39 |                      strerror(-retval), -retval); \
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/virtio/vhost.c:1006:9: note: in expansion of macro ‘VHOST_OPS_DEBUG’
 1006 |         VHOST_OPS_DEBUG(r, "extended features without device support");
      |         ^~~~~~~~~~~~~~~
../hw/virtio/vhost.c:989:9: note: ‘r’ was declared here
  989 |     int r;
      |         ^
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:168: run-ninja] Error 1
make[1]: Leaving directory '/mnt/tests/distribution/command/qemu/build'

Thanks
Lei

On Fri, Jul 11, 2025 at 9:08 PM Paolo Abeni <pabeni@redhat.com> wrote:
>
> Some virtualized deployments use UDP tunnel pervasively and are impacted
> negatively by the lack of GSO support for such kind of traffic in the
> virtual NIC driver.
>
> The virtio_net specification recently introduced support for GSO over
> UDP tunnel, and the kernel side of the implementation has been merged
> into the net-next tree; this series updates the virtio implementation to
> support such a feature.
>
> Currently the qemu virtio support limits the feature space to 64 bits,
> while the virtio specification allows for a larger number of features.
> Specifically the GSO-over-UDP-tunnel-related virtio features use bits
> 65-69; the larger part of this series (patches 3-11) actually deals with
> extending the features space.
>
> The extended features are carried by fixed size uint64_t arrays,
> bringing the current maximum features number to 128.
>
> The patches use some syntactic sugar to try to minimize the otherwise
> very large code churn. Specifically the extended features are boundled
> in an union with 'legacy' features definition, allowing no changes in
> the virtio devices not needing the extended features set.
>
> The actual offload implementation is in patches 12 and 13 and boils down
> to propagating the new offload to the tun devices and the vhost backend.
>
> Finally patch 1 is a small pre-req refactor that ideally could enter the
> tree separately; it's presented here in the same series to help
> reviewers more easily getting the full picture and patch 2 is a needed
> linux headers update.
>
> Tested with basic stream transfer with all the possible permutations of
> host kernel/qemu/guest kernel with/without GSO over UDP tunnel support,
> vs snapshots creation and restore and vs migration.
>
> Sharing again as RFC as the kernel bits have not entered the Linus tree
> yet - but they should on next merge window.
>
> Paolo Abeni (13):
>   net: bundle all offloads in a single struct
>   linux-headers: Update to Linux ~v6.16-rc5 net-next
>   virtio: introduce extended features type
>   virtio: serialize extended features state
>   virtio: add support for negotiating extended features
>   virtio-pci: implement support for extended features
>   vhost: add support for negotiating extended features
>   qmp: update virtio features map to support extended features
>   vhost-backend: implement extended features support
>   vhost-net: implement extended features support
>   virtio-net: implement extended features support
>   net: implement tunnel probing
>   net: implement UDP tunnel features offloading
>
>  hw/net/e1000e_core.c                         |   5 +-
>  hw/net/igb_core.c                            |   5 +-
>  hw/net/vhost_net-stub.c                      |   8 +-
>  hw/net/vhost_net.c                           |  50 +++--
>  hw/net/virtio-net.c                          | 215 +++++++++++++------
>  hw/net/vmxnet3.c                             |  13 +-
>  hw/virtio/vhost-backend.c                    |  62 +++++-
>  hw/virtio/vhost.c                            |  73 ++++++-
>  hw/virtio/virtio-bus.c                       |  11 +-
>  hw/virtio/virtio-hmp-cmds.c                  |   3 +-
>  hw/virtio/virtio-pci.c                       | 101 ++++++++-
>  hw/virtio/virtio-qmp.c                       |  89 +++++---
>  hw/virtio/virtio-qmp.h                       |   3 +-
>  hw/virtio/virtio.c                           | 111 ++++++++--
>  include/hw/virtio/vhost-backend.h            |   6 +
>  include/hw/virtio/vhost.h                    |  36 +++-
>  include/hw/virtio/virtio-features.h          | 124 +++++++++++
>  include/hw/virtio/virtio-net.h               |   2 +-
>  include/hw/virtio/virtio-pci.h               |   6 +-
>  include/hw/virtio/virtio.h                   |  11 +-
>  include/net/net.h                            |  20 +-
>  include/net/vhost_net.h                      |  33 ++-
>  include/standard-headers/linux/ethtool.h     |   4 +-
>  include/standard-headers/linux/vhost_types.h |   5 +
>  include/standard-headers/linux/virtio_net.h  |  33 +++
>  linux-headers/asm-x86/kvm.h                  |   8 +-
>  linux-headers/linux/kvm.h                    |   4 +
>  linux-headers/linux/vhost.h                  |   7 +
>  net/net.c                                    |  17 +-
>  net/netmap.c                                 |   3 +-
>  net/tap-bsd.c                                |   8 +-
>  net/tap-linux.c                              |  38 +++-
>  net/tap-linux.h                              |   9 +
>  net/tap-solaris.c                            |   9 +-
>  net/tap-stub.c                               |   8 +-
>  net/tap.c                                    |  19 +-
>  net/tap_int.h                                |   5 +-
>  qapi/virtio.json                             |   8 +-
>  38 files changed, 945 insertions(+), 227 deletions(-)
>  create mode 100644 include/hw/virtio/virtio-features.h
>
> --
> 2.50.0
>
>
Re: [PATCH RFC v2 00/13] virtio: introduce support for GSO over UDP tunnel
Posted by Paolo Abeni 5 months ago
On 7/14/25 10:43 AM, Lei Yang wrote:
> Does the compile of this series of patches require support for a
> special kernel environment? I hit a compile issue after applied you
> patches:
> [1440/2928] Compiling C object libsystem.a.p/hw_virtio_vhost.c.o
> FAILED: libsystem.a.p/hw_virtio_vhost.c.o
> cc -m64 -Ilibsystem.a.p -I. -I.. -Isubprojects/dtc/libfdt
> -I../subprojects/dtc/libfdt -Isubprojects/libvduse
> -I../subprojects/libvduse -Iui -Iqapi -Itrace -Iui/shader
> -I/usr/include/pixman-1 -I/usr/include/glib-2.0
> -I/usr/lib64/glib-2.0/include -I/usr/include/libmount
> -I/usr/include/blkid -I/usr/include/sysprof-6
> -I/usr/include/gio-unix-2.0 -I/usr/include/slirp
> -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g
> -fstack-protector-strong -Wempty-body -Wendif-labels
> -Wexpansion-to-defined -Wformat-security -Wformat-y2k
> -Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self
> -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs
> -Wold-style-declaration -Wold-style-definition -Wredundant-decls
> -Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla
> -Wwrite-strings -Wno-missing-include-dirs -Wno-psabi
> -Wno-shift-negative-value -isystem
> /mnt/tests/distribution/command/qemu/linux-headers -isystem
> linux-headers -iquote . -iquote /mnt/tests/distribution/command/qemu
> -iquote /mnt/tests/distribution/command/qemu/include -iquote
> /mnt/tests/distribution/command/qemu/host/include/x86_64 -iquote
> /mnt/tests/distribution/command/qemu/host/include/generic -iquote
> /mnt/tests/distribution/command/qemu/tcg/i386 -pthread -mcx16 -msse2
> -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> -fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
> -fzero-call-used-regs=used-gpr -fPIE -DWITH_GZFILEOP -DCONFIG_SOFTMMU
> -DCOMPILING_SYSTEM_VS_USER -MD -MQ libsystem.a.p/hw_virtio_vhost.c.o
> -MF libsystem.a.p/hw_virtio_vhost.c.o.d -o
> libsystem.a.p/hw_virtio_vhost.c.o -c ../hw/virtio/vhost.c
> ../hw/virtio/vhost.c: In function ‘vhost_dev_set_features’:
> ../hw/virtio/vhost.c:38:9: error: ‘r’ may be used uninitialized
> [-Werror=maybe-uninitialized]
>    38 |         error_report(fmt ": %s (%d)", ## __VA_ARGS__, \
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    39 |                      strerror(-retval), -retval); \
>       |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../hw/virtio/vhost.c:1006:9: note: in expansion of macro ‘VHOST_OPS_DEBUG’
>  1006 |         VHOST_OPS_DEBUG(r, "extended features without device support");
>       |         ^~~~~~~~~~~~~~~
> ../hw/virtio/vhost.c:989:9: note: ‘r’ was declared here
>   989 |     int r;
>       |         ^
> cc1: all warnings being treated as errors
> ninja: build stopped: subcommand failed.
> make[1]: *** [Makefile:168: run-ninja] Error 1
> make[1]: Leaving directory '/mnt/tests/distribution/command/qemu/build'
> make[1]: Entering directory '/mnt/tests/distribution/command/qemu/build'
> [1/1493] Generating subprojects/dtc/version_gen.h with a custom command
> [2/1493] Generating qemu-version.h with a custom command (wrapped by
> meson to capture output)
> [3/1492] Compiling C object libsystem.a.p/hw_virtio_vhost.c.o
> FAILED: libsystem.a.p/hw_virtio_vhost.c.o
> cc -m64 -Ilibsystem.a.p -I. -I.. -Isubprojects/dtc/libfdt
> -I../subprojects/dtc/libfdt -Isubprojects/libvduse
> -I../subprojects/libvduse -Iui -Iqapi -Itrace -Iui/shader
> -I/usr/include/pixman-1 -I/usr/include/glib-2.0
> -I/usr/lib64/glib-2.0/include -I/usr/include/libmount
> -I/usr/include/blkid -I/usr/include/sysprof-6
> -I/usr/include/gio-unix-2.0 -I/usr/include/slirp
> -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g
> -fstack-protector-strong -Wempty-body -Wendif-labels
> -Wexpansion-to-defined -Wformat-security -Wformat-y2k
> -Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self
> -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs
> -Wold-style-declaration -Wold-style-definition -Wredundant-decls
> -Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla
> -Wwrite-strings -Wno-missing-include-dirs -Wno-psabi
> -Wno-shift-negative-value -isystem
> /mnt/tests/distribution/command/qemu/linux-headers -isystem
> linux-headers -iquote . -iquote /mnt/tests/distribution/command/qemu
> -iquote /mnt/tests/distribution/command/qemu/include -iquote
> /mnt/tests/distribution/command/qemu/host/include/x86_64 -iquote
> /mnt/tests/distribution/command/qemu/host/include/generic -iquote
> /mnt/tests/distribution/command/qemu/tcg/i386 -pthread -mcx16 -msse2
> -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> -fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
> -fzero-call-used-regs=used-gpr -fPIE -DWITH_GZFILEOP -DCONFIG_SOFTMMU
> -DCOMPILING_SYSTEM_VS_USER -MD -MQ libsystem.a.p/hw_virtio_vhost.c.o
> -MF libsystem.a.p/hw_virtio_vhost.c.o.d -o
> libsystem.a.p/hw_virtio_vhost.c.o -c ../hw/virtio/vhost.c
> ../hw/virtio/vhost.c: In function ‘vhost_dev_set_features’:
> ../hw/virtio/vhost.c:38:9: error: ‘r’ may be used uninitialized
> [-Werror=maybe-uninitialized]
>    38 |         error_report(fmt ": %s (%d)", ## __VA_ARGS__, \
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    39 |                      strerror(-retval), -retval); \
>       |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../hw/virtio/vhost.c:1006:9: note: in expansion of macro ‘VHOST_OPS_DEBUG’
>  1006 |         VHOST_OPS_DEBUG(r, "extended features without device support");
>       |         ^~~~~~~~~~~~~~~
> ../hw/virtio/vhost.c:989:9: note: ‘r’ was declared here
>   989 |     int r;
>       |         ^
> cc1: all warnings being treated as errors
> ninja: build stopped: subcommand failed.
> make[1]: *** [Makefile:168: run-ninja] Error 1
> make[1]: Leaving directory '/mnt/tests/distribution/command/qemu/build'

Thank you for reporting the problem.

No special kernel requirement to build the series, the above is just a
gross mistake on my side in patch 7/13. If you want to test the series,
please apply incrementally the following diff.

What baffles me is that gcc 14.3.1 and 11.5.0 are not raising the
warning (that looks legit/correct) here.

I'll fix the above in the next revision.

Note that you need a running kernel based on current net-next tree in
both the hypervisor and the guest to actually leverage the new feature.

Thanks,

Paolo
---
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 2eee9b0886..c4eab5ce08 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1003,8 +1003,8 @@ static int vhost_dev_set_features(struct vhost_dev
*dev,

     if (virtio_features_use_extended(features) &&
         !dev->vhost_ops->vhost_set_features_ex) {
-        VHOST_OPS_DEBUG(r, "extended features without device support");
         r = -EINVAL;
+        VHOST_OPS_DEBUG(r, "extended features without device support");
         goto out;
     }


Re: [PATCH RFC v2 00/13] virtio: introduce support for GSO over UDP tunnel
Posted by Lei Yang 5 months ago
On Mon, Jul 14, 2025 at 5:05 PM Paolo Abeni <pabeni@redhat.com> wrote:
>
> On 7/14/25 10:43 AM, Lei Yang wrote:
> > Does the compile of this series of patches require support for a
> > special kernel environment? I hit a compile issue after applied you
> > patches:
> > [1440/2928] Compiling C object libsystem.a.p/hw_virtio_vhost.c.o
> > FAILED: libsystem.a.p/hw_virtio_vhost.c.o
> > cc -m64 -Ilibsystem.a.p -I. -I.. -Isubprojects/dtc/libfdt
> > -I../subprojects/dtc/libfdt -Isubprojects/libvduse
> > -I../subprojects/libvduse -Iui -Iqapi -Itrace -Iui/shader
> > -I/usr/include/pixman-1 -I/usr/include/glib-2.0
> > -I/usr/lib64/glib-2.0/include -I/usr/include/libmount
> > -I/usr/include/blkid -I/usr/include/sysprof-6
> > -I/usr/include/gio-unix-2.0 -I/usr/include/slirp
> > -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g
> > -fstack-protector-strong -Wempty-body -Wendif-labels
> > -Wexpansion-to-defined -Wformat-security -Wformat-y2k
> > -Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self
> > -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs
> > -Wold-style-declaration -Wold-style-definition -Wredundant-decls
> > -Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla
> > -Wwrite-strings -Wno-missing-include-dirs -Wno-psabi
> > -Wno-shift-negative-value -isystem
> > /mnt/tests/distribution/command/qemu/linux-headers -isystem
> > linux-headers -iquote . -iquote /mnt/tests/distribution/command/qemu
> > -iquote /mnt/tests/distribution/command/qemu/include -iquote
> > /mnt/tests/distribution/command/qemu/host/include/x86_64 -iquote
> > /mnt/tests/distribution/command/qemu/host/include/generic -iquote
> > /mnt/tests/distribution/command/qemu/tcg/i386 -pthread -mcx16 -msse2
> > -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> > -fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
> > -fzero-call-used-regs=used-gpr -fPIE -DWITH_GZFILEOP -DCONFIG_SOFTMMU
> > -DCOMPILING_SYSTEM_VS_USER -MD -MQ libsystem.a.p/hw_virtio_vhost.c.o
> > -MF libsystem.a.p/hw_virtio_vhost.c.o.d -o
> > libsystem.a.p/hw_virtio_vhost.c.o -c ../hw/virtio/vhost.c
> > ../hw/virtio/vhost.c: In function ‘vhost_dev_set_features’:
> > ../hw/virtio/vhost.c:38:9: error: ‘r’ may be used uninitialized
> > [-Werror=maybe-uninitialized]
> >    38 |         error_report(fmt ": %s (%d)", ## __VA_ARGS__, \
> >       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    39 |                      strerror(-retval), -retval); \
> >       |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ../hw/virtio/vhost.c:1006:9: note: in expansion of macro ‘VHOST_OPS_DEBUG’
> >  1006 |         VHOST_OPS_DEBUG(r, "extended features without device support");
> >       |         ^~~~~~~~~~~~~~~
> > ../hw/virtio/vhost.c:989:9: note: ‘r’ was declared here
> >   989 |     int r;
> >       |         ^
> > cc1: all warnings being treated as errors
> > ninja: build stopped: subcommand failed.
> > make[1]: *** [Makefile:168: run-ninja] Error 1
> > make[1]: Leaving directory '/mnt/tests/distribution/command/qemu/build'
> > make[1]: Entering directory '/mnt/tests/distribution/command/qemu/build'
> > [1/1493] Generating subprojects/dtc/version_gen.h with a custom command
> > [2/1493] Generating qemu-version.h with a custom command (wrapped by
> > meson to capture output)
> > [3/1492] Compiling C object libsystem.a.p/hw_virtio_vhost.c.o
> > FAILED: libsystem.a.p/hw_virtio_vhost.c.o
> > cc -m64 -Ilibsystem.a.p -I. -I.. -Isubprojects/dtc/libfdt
> > -I../subprojects/dtc/libfdt -Isubprojects/libvduse
> > -I../subprojects/libvduse -Iui -Iqapi -Itrace -Iui/shader
> > -I/usr/include/pixman-1 -I/usr/include/glib-2.0
> > -I/usr/lib64/glib-2.0/include -I/usr/include/libmount
> > -I/usr/include/blkid -I/usr/include/sysprof-6
> > -I/usr/include/gio-unix-2.0 -I/usr/include/slirp
> > -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g
> > -fstack-protector-strong -Wempty-body -Wendif-labels
> > -Wexpansion-to-defined -Wformat-security -Wformat-y2k
> > -Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self
> > -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs
> > -Wold-style-declaration -Wold-style-definition -Wredundant-decls
> > -Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla
> > -Wwrite-strings -Wno-missing-include-dirs -Wno-psabi
> > -Wno-shift-negative-value -isystem
> > /mnt/tests/distribution/command/qemu/linux-headers -isystem
> > linux-headers -iquote . -iquote /mnt/tests/distribution/command/qemu
> > -iquote /mnt/tests/distribution/command/qemu/include -iquote
> > /mnt/tests/distribution/command/qemu/host/include/x86_64 -iquote
> > /mnt/tests/distribution/command/qemu/host/include/generic -iquote
> > /mnt/tests/distribution/command/qemu/tcg/i386 -pthread -mcx16 -msse2
> > -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> > -fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
> > -fzero-call-used-regs=used-gpr -fPIE -DWITH_GZFILEOP -DCONFIG_SOFTMMU
> > -DCOMPILING_SYSTEM_VS_USER -MD -MQ libsystem.a.p/hw_virtio_vhost.c.o
> > -MF libsystem.a.p/hw_virtio_vhost.c.o.d -o
> > libsystem.a.p/hw_virtio_vhost.c.o -c ../hw/virtio/vhost.c
> > ../hw/virtio/vhost.c: In function ‘vhost_dev_set_features’:
> > ../hw/virtio/vhost.c:38:9: error: ‘r’ may be used uninitialized
> > [-Werror=maybe-uninitialized]
> >    38 |         error_report(fmt ": %s (%d)", ## __VA_ARGS__, \
> >       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    39 |                      strerror(-retval), -retval); \
> >       |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ../hw/virtio/vhost.c:1006:9: note: in expansion of macro ‘VHOST_OPS_DEBUG’
> >  1006 |         VHOST_OPS_DEBUG(r, "extended features without device support");
> >       |         ^~~~~~~~~~~~~~~
> > ../hw/virtio/vhost.c:989:9: note: ‘r’ was declared here
> >   989 |     int r;
> >       |         ^
> > cc1: all warnings being treated as errors
> > ninja: build stopped: subcommand failed.
> > make[1]: *** [Makefile:168: run-ninja] Error 1
> > make[1]: Leaving directory '/mnt/tests/distribution/command/qemu/build'
>
> Thank you for reporting the problem.
>
> No special kernel requirement to build the series, the above is just a
> gross mistake on my side in patch 7/13. If you want to test the series,
> please apply incrementally the following diff.
>
> What baffles me is that gcc 14.3.1 and 11.5.0 are not raising the
> warning (that looks legit/correct) here.
>
> I'll fix the above in the next revision.
>
> Note that you need a running kernel based on current net-next tree in
> both the hypervisor and the guest to actually leverage the new feature.

Ok, I will test this series again and update the test results.

Thanks
Lei
>
> Thanks,
>
> Paolo
> ---
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 2eee9b0886..c4eab5ce08 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1003,8 +1003,8 @@ static int vhost_dev_set_features(struct vhost_dev
> *dev,
>
>      if (virtio_features_use_extended(features) &&
>          !dev->vhost_ops->vhost_set_features_ex) {
> -        VHOST_OPS_DEBUG(r, "extended features without device support");
>          r = -EINVAL;
> +        VHOST_OPS_DEBUG(r, "extended features without device support");
>          goto out;
>      }
>