[PULL V2 00/15] Net patches

Jason Wang posted 15 patches 2 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220310023907.2443-1-jasowang@redhat.com
Test checkpatch passed
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, Peter Xu <peterx@redhat.com>
There is a newer version of this series
hw/net/virtio-net.c                |   1 +
hw/virtio/meson.build              |   2 +-
hw/virtio/vhost-iova-tree.c        | 110 +++++++
hw/virtio/vhost-iova-tree.h        |  27 ++
hw/virtio/vhost-shadow-virtqueue.c | 638 +++++++++++++++++++++++++++++++++++++
hw/virtio/vhost-shadow-virtqueue.h |  87 +++++
hw/virtio/vhost-vdpa.c             | 525 +++++++++++++++++++++++++++++-
include/hw/virtio/vhost-vdpa.h     |   8 +
include/qemu/iova-tree.h           |  38 ++-
util/iova-tree.c                   | 169 ++++++++++
10 files changed, 1588 insertions(+), 17 deletions(-)
create mode 100644 hw/virtio/vhost-iova-tree.c
create mode 100644 hw/virtio/vhost-iova-tree.h
create mode 100644 hw/virtio/vhost-shadow-virtqueue.c
create mode 100644 hw/virtio/vhost-shadow-virtqueue.h
[PULL V2 00/15] Net patches
Posted by Jason Wang 2 years, 1 month ago
The following changes since commit d9ccf33f9479201e5add8db0af68ca9ca8da358b:

  Merge remote-tracking branch 'remotes/lvivier-gitlab/tags/linux-user-for-7.0-pull-request' into staging (2022-03-09 20:01:17 +0000)

are available in the git repository at:

  https://github.com/jasowang/qemu.git tags/net-pull-request

for you to fetch changes up to eea40402ecf895ed345f8e8eb07dbb484f4542c5:

  vdpa: Expose VHOST_F_LOG_ALL on SVQ (2022-03-10 10:26:32 +0800)

----------------------------------------------------------------

----------------------------------------------------------------
Eugenio Pérez (14):
      vhost: Add VhostShadowVirtqueue
      vhost: Add Shadow VirtQueue kick forwarding capabilities
      vhost: Add Shadow VirtQueue call forwarding capabilities
      vhost: Add vhost_svq_valid_features to shadow vq
      virtio: Add vhost_svq_get_vring_addr
      vdpa: adapt vhost_ops callbacks to svq
      vhost: Shadow virtqueue buffers forwarding
      util: Add iova_tree_alloc_map
      util: add iova_tree_find_iova
      vhost: Add VhostIOVATree
      vdpa: Add custom IOTLB translations to SVQ
      vdpa: Adapt vhost_vdpa_get_vring_base to SVQ
      vdpa: Never set log_base addr if SVQ is enabled
      vdpa: Expose VHOST_F_LOG_ALL on SVQ

Jason Wang (1):
      virtio-net: fix map leaking on error during receive

 hw/net/virtio-net.c                |   1 +
 hw/virtio/meson.build              |   2 +-
 hw/virtio/vhost-iova-tree.c        | 110 +++++++
 hw/virtio/vhost-iova-tree.h        |  27 ++
 hw/virtio/vhost-shadow-virtqueue.c | 638 +++++++++++++++++++++++++++++++++++++
 hw/virtio/vhost-shadow-virtqueue.h |  87 +++++
 hw/virtio/vhost-vdpa.c             | 525 +++++++++++++++++++++++++++++-
 include/hw/virtio/vhost-vdpa.h     |   8 +
 include/qemu/iova-tree.h           |  38 ++-
 util/iova-tree.c                   | 169 ++++++++++
 10 files changed, 1588 insertions(+), 17 deletions(-)
 create mode 100644 hw/virtio/vhost-iova-tree.c
 create mode 100644 hw/virtio/vhost-iova-tree.h
 create mode 100644 hw/virtio/vhost-shadow-virtqueue.c
 create mode 100644 hw/virtio/vhost-shadow-virtqueue.h


Re: [PULL V2 00/15] Net patches
Posted by Peter Maydell 2 years, 1 month ago
On Thu, 10 Mar 2022 at 02:39, Jason Wang <jasowang@redhat.com> wrote:
>
> The following changes since commit d9ccf33f9479201e5add8db0af68ca9ca8da358b:
>
>   Merge remote-tracking branch 'remotes/lvivier-gitlab/tags/linux-user-for-7.0-pull-request' into staging (2022-03-09 20:01:17 +0000)
>
> are available in the git repository at:
>
>   https://github.com/jasowang/qemu.git tags/net-pull-request
>
> for you to fetch changes up to eea40402ecf895ed345f8e8eb07dbb484f4542c5:
>
>   vdpa: Expose VHOST_F_LOG_ALL on SVQ (2022-03-10 10:26:32 +0800)
>
> ----------------------------------------------------------------
>

Lots of 32-bit compile issues: this is 32-bit arm:
https://gitlab.com/qemu-project/qemu/-/jobs/2188500721
i386 the same:
https://gitlab.com/qemu-project/qemu/-/jobs/2188500747
and 32-bit mips:
https://gitlab.com/qemu-project/qemu/-/jobs/2188500753

../hw/virtio/vhost-shadow-virtqueue.c: In function 'vhost_svq_valid_features':
../hw/virtio/vhost-shadow-virtqueue.c:43:28: error: passing argument 2
of 'set_bit' from incompatible pointer type
[-Werror=incompatible-pointer-types]
set_bit(b, &svq_features);
^~~~~~~~~~~~~
In file included from /builds/qemu-project/qemu/include/qemu/bitmap.h:16,
from /builds/qemu-project/qemu/include/hw/qdev-core.h:5,
from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:18,
from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
from ../hw/virtio/vhost-shadow-virtqueue.c:11:
/builds/qemu-project/qemu/include/qemu/bitops.h:36:52: note: expected
'long unsigned int *' but argument is of type 'uint64_t *' {aka 'long
long unsigned int *'}
static inline void set_bit(long nr, unsigned long *addr)
~~~~~~~~~~~~~~~^~~~
../hw/virtio/vhost-shadow-virtqueue.c:50:30: error: passing argument 2
of 'clear_bit' from incompatible pointer type
[-Werror=incompatible-pointer-types]
clear_bit(b, &svq_features);
^~~~~~~~~~~~~
In file included from /builds/qemu-project/qemu/include/qemu/bitmap.h:16,
from /builds/qemu-project/qemu/include/hw/qdev-core.h:5,
from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:18,
from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
from ../hw/virtio/vhost-shadow-virtqueue.c:11:
/builds/qemu-project/qemu/include/qemu/bitops.h:62:54: note: expected
'long unsigned int *' but argument is of type 'uint64_t *' {aka 'long
long unsigned int *'}
static inline void clear_bit(long nr, unsigned long *addr)
~~~~~~~~~~~~~~~^~~~
../hw/virtio/vhost-shadow-virtqueue.c: In function 'vhost_svq_translate_addr':
../hw/virtio/vhost-shadow-virtqueue.c:91:32: error: cast from pointer
to integer of different size [-Werror=pointer-to-int-cast]
.translated_addr = (hwaddr)iovec[i].iov_base,
^
../hw/virtio/vhost-shadow-virtqueue.c:109:20: error: cast to pointer
from integer of different size [-Werror=int-to-pointer-cast]
addrs[i] = (void *)(map->iova + off);
^
In file included from /builds/qemu-project/qemu/include/qemu/osdep.h:37,
from ../hw/virtio/vhost-shadow-virtqueue.c:10:
../hw/virtio/vhost-shadow-virtqueue.c:111:49: error: incompatible type
for argument 1 of 'int128_add'
if (unlikely(int128_gt(int128_add(needle.translated_addr,
~~~~~~^~~~~~~~~~~~~~~~
/builds/qemu-project/qemu/include/qemu/compiler.h:43:43: note: in
definition of macro 'unlikely'
#define unlikely(x) __builtin_expect(!!(x), 0)
^
In file included from /builds/qemu-project/qemu/include/exec/memory.h:26,
from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:17,
from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
from ../hw/virtio/vhost-shadow-virtqueue.c:11:
/builds/qemu-project/qemu/include/qemu/int128.h:313:40: note: expected
'Int128' {aka 'struct Int128'} but argument is of type 'hwaddr' {aka
'long long unsigned int'}
static inline Int128 int128_add(Int128 a, Int128 b)
~~~~~~~^
In file included from /builds/qemu-project/qemu/include/qemu/osdep.h:37,
from ../hw/virtio/vhost-shadow-virtqueue.c:10:
../hw/virtio/vhost-shadow-virtqueue.c:112:51: error: incompatible type
for argument 2 of 'int128_add'
iovec[i].iov_len),
~~~~~~~~^~~~~~~~
/builds/qemu-project/qemu/include/qemu/compiler.h:43:43: note: in
definition of macro 'unlikely'
#define unlikely(x) __builtin_expect(!!(x), 0)
^
In file included from /builds/qemu-project/qemu/include/exec/memory.h:26,
from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:17,
from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
from ../hw/virtio/vhost-shadow-virtqueue.c:11:
/builds/qemu-project/qemu/include/qemu/int128.h:313:50: note: expected
'Int128' {aka 'struct Int128'} but argument is of type 'size_t' {aka
'const unsigned int'}
static inline Int128 int128_add(Int128 a, Int128 b)
~~~~~~~^
In file included from /builds/qemu-project/qemu/include/qemu/osdep.h:37,
from ../hw/virtio/vhost-shadow-virtqueue.c:10:
../hw/virtio/vhost-shadow-virtqueue.c:113:53: error: incompatible type
for argument 2 of 'int128_gt'
map->translated_addr + map->size))) {
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/builds/qemu-project/qemu/include/qemu/compiler.h:43:43: note: in
definition of macro 'unlikely'
#define unlikely(x) __builtin_expect(!!(x), 0)
^
In file included from /builds/qemu-project/qemu/include/exec/memory.h:26,
from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:17,
from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
from ../hw/virtio/vhost-shadow-virtqueue.c:11:
/builds/qemu-project/qemu/include/qemu/int128.h:367:47: note: expected
'Int128' {aka 'struct Int128'} but argument is of type 'long long
unsigned int'
static inline bool int128_gt(Int128 a, Int128 b)
~~~~~~~^
../hw/virtio/vhost-shadow-virtqueue.c: In function 'vhost_vring_write_descs':
../hw/virtio/vhost-shadow-virtqueue.c:143:37: error: cast from pointer
to integer of different size [-Werror=pointer-to-int-cast]
descs[i].addr = cpu_to_le64((hwaddr)sg[n]);
^
../hw/virtio/vhost-shadow-virtqueue.c: In function 'vhost_svq_get_vring_addr':
../hw/virtio/vhost-shadow-virtqueue.c:465:28: error: cast from pointer
to integer of different size [-Werror=pointer-to-int-cast]
addr->desc_user_addr = (uint64_t)svq->vring.desc;
^
../hw/virtio/vhost-shadow-virtqueue.c:466:29: error: cast from pointer
to integer of different size [-Werror=pointer-to-int-cast]
addr->avail_user_addr = (uint64_t)svq->vring.avail;
^
../hw/virtio/vhost-shadow-virtqueue.c:467:28: error: cast from pointer
to integer of different size [-Werror=pointer-to-int-cast]
addr->used_user_addr = (uint64_t)svq->vring.used;
^
cc1: all warnings being treated as errors


-- PMM
Re: [PULL V2 00/15] Net patches
Posted by Jason Wang 2 years, 1 month ago
On Fri, Mar 11, 2022 at 1:07 AM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On Thu, 10 Mar 2022 at 02:39, Jason Wang <jasowang@redhat.com> wrote:
> >
> > The following changes since commit
> d9ccf33f9479201e5add8db0af68ca9ca8da358b:
> >
> >   Merge remote-tracking branch
> 'remotes/lvivier-gitlab/tags/linux-user-for-7.0-pull-request' into staging
> (2022-03-09 20:01:17 +0000)
> >
> > are available in the git repository at:
> >
> >   https://github.com/jasowang/qemu.git tags/net-pull-request
> >
> > for you to fetch changes up to eea40402ecf895ed345f8e8eb07dbb484f4542c5:
> >
> >   vdpa: Expose VHOST_F_LOG_ALL on SVQ (2022-03-10 10:26:32 +0800)
> >
> > ----------------------------------------------------------------
> >
>
> Lots of 32-bit compile issues: this is 32-bit arm:
> https://gitlab.com/qemu-project/qemu/-/jobs/2188500721
> i386 the same:
> https://gitlab.com/qemu-project/qemu/-/jobs/2188500747
> and 32-bit mips:
> https://gitlab.com/qemu-project/qemu/-/jobs/2188500753


Eugenio, please fix those warnings and send a new version.

Thanks


>
>
> ../hw/virtio/vhost-shadow-virtqueue.c: In function
> 'vhost_svq_valid_features':
> ../hw/virtio/vhost-shadow-virtqueue.c:43:28: error: passing argument 2
> of 'set_bit' from incompatible pointer type
> [-Werror=incompatible-pointer-types]
> set_bit(b, &svq_features);
> ^~~~~~~~~~~~~
> In file included from /builds/qemu-project/qemu/include/qemu/bitmap.h:16,
> from /builds/qemu-project/qemu/include/hw/qdev-core.h:5,
> from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:18,
> from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
> from ../hw/virtio/vhost-shadow-virtqueue.c:11:
> /builds/qemu-project/qemu/include/qemu/bitops.h:36:52: note: expected
> 'long unsigned int *' but argument is of type 'uint64_t *' {aka 'long
> long unsigned int *'}
> static inline void set_bit(long nr, unsigned long *addr)
> ~~~~~~~~~~~~~~~^~~~
> ../hw/virtio/vhost-shadow-virtqueue.c:50:30: error: passing argument 2
> of 'clear_bit' from incompatible pointer type
> [-Werror=incompatible-pointer-types]
> clear_bit(b, &svq_features);
> ^~~~~~~~~~~~~
> In file included from /builds/qemu-project/qemu/include/qemu/bitmap.h:16,
> from /builds/qemu-project/qemu/include/hw/qdev-core.h:5,
> from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:18,
> from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
> from ../hw/virtio/vhost-shadow-virtqueue.c:11:
> /builds/qemu-project/qemu/include/qemu/bitops.h:62:54: note: expected
> 'long unsigned int *' but argument is of type 'uint64_t *' {aka 'long
> long unsigned int *'}
> static inline void clear_bit(long nr, unsigned long *addr)
> ~~~~~~~~~~~~~~~^~~~
> ../hw/virtio/vhost-shadow-virtqueue.c: In function
> 'vhost_svq_translate_addr':
> ../hw/virtio/vhost-shadow-virtqueue.c:91:32: error: cast from pointer
> to integer of different size [-Werror=pointer-to-int-cast]
> .translated_addr = (hwaddr)iovec[i].iov_base,
> ^
> ../hw/virtio/vhost-shadow-virtqueue.c:109:20: error: cast to pointer
> from integer of different size [-Werror=int-to-pointer-cast]
> addrs[i] = (void *)(map->iova + off);
> ^
> In file included from /builds/qemu-project/qemu/include/qemu/osdep.h:37,
> from ../hw/virtio/vhost-shadow-virtqueue.c:10:
> ../hw/virtio/vhost-shadow-virtqueue.c:111:49: error: incompatible type
> for argument 1 of 'int128_add'
> if (unlikely(int128_gt(int128_add(needle.translated_addr,
> ~~~~~~^~~~~~~~~~~~~~~~
> /builds/qemu-project/qemu/include/qemu/compiler.h:43:43: note: in
> definition of macro 'unlikely'
> #define unlikely(x) __builtin_expect(!!(x), 0)
> ^
> In file included from /builds/qemu-project/qemu/include/exec/memory.h:26,
> from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:17,
> from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
> from ../hw/virtio/vhost-shadow-virtqueue.c:11:
> /builds/qemu-project/qemu/include/qemu/int128.h:313:40: note: expected
> 'Int128' {aka 'struct Int128'} but argument is of type 'hwaddr' {aka
> 'long long unsigned int'}
> static inline Int128 int128_add(Int128 a, Int128 b)
> ~~~~~~~^
> In file included from /builds/qemu-project/qemu/include/qemu/osdep.h:37,
> from ../hw/virtio/vhost-shadow-virtqueue.c:10:
> ../hw/virtio/vhost-shadow-virtqueue.c:112:51: error: incompatible type
> for argument 2 of 'int128_add'
> iovec[i].iov_len),
> ~~~~~~~~^~~~~~~~
> /builds/qemu-project/qemu/include/qemu/compiler.h:43:43: note: in
> definition of macro 'unlikely'
> #define unlikely(x) __builtin_expect(!!(x), 0)
> ^
> In file included from /builds/qemu-project/qemu/include/exec/memory.h:26,
> from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:17,
> from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
> from ../hw/virtio/vhost-shadow-virtqueue.c:11:
> /builds/qemu-project/qemu/include/qemu/int128.h:313:50: note: expected
> 'Int128' {aka 'struct Int128'} but argument is of type 'size_t' {aka
> 'const unsigned int'}
> static inline Int128 int128_add(Int128 a, Int128 b)
> ~~~~~~~^
> In file included from /builds/qemu-project/qemu/include/qemu/osdep.h:37,
> from ../hw/virtio/vhost-shadow-virtqueue.c:10:
> ../hw/virtio/vhost-shadow-virtqueue.c:113:53: error: incompatible type
> for argument 2 of 'int128_gt'
> map->translated_addr + map->size))) {
> ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
> /builds/qemu-project/qemu/include/qemu/compiler.h:43:43: note: in
> definition of macro 'unlikely'
> #define unlikely(x) __builtin_expect(!!(x), 0)
> ^
> In file included from /builds/qemu-project/qemu/include/exec/memory.h:26,
> from /builds/qemu-project/qemu/include/hw/virtio/virtio.h:17,
> from /builds/qemu-project/qemu/hw/virtio/vhost-shadow-virtqueue.h:14,
> from ../hw/virtio/vhost-shadow-virtqueue.c:11:
> /builds/qemu-project/qemu/include/qemu/int128.h:367:47: note: expected
> 'Int128' {aka 'struct Int128'} but argument is of type 'long long
> unsigned int'
> static inline bool int128_gt(Int128 a, Int128 b)
> ~~~~~~~^
> ../hw/virtio/vhost-shadow-virtqueue.c: In function
> 'vhost_vring_write_descs':
> ../hw/virtio/vhost-shadow-virtqueue.c:143:37: error: cast from pointer
> to integer of different size [-Werror=pointer-to-int-cast]
> descs[i].addr = cpu_to_le64((hwaddr)sg[n]);
> ^
> ../hw/virtio/vhost-shadow-virtqueue.c: In function
> 'vhost_svq_get_vring_addr':
> ../hw/virtio/vhost-shadow-virtqueue.c:465:28: error: cast from pointer
> to integer of different size [-Werror=pointer-to-int-cast]
> addr->desc_user_addr = (uint64_t)svq->vring.desc;
> ^
> ../hw/virtio/vhost-shadow-virtqueue.c:466:29: error: cast from pointer
> to integer of different size [-Werror=pointer-to-int-cast]
> addr->avail_user_addr = (uint64_t)svq->vring.avail;
> ^
> ../hw/virtio/vhost-shadow-virtqueue.c:467:28: error: cast from pointer
> to integer of different size [-Werror=pointer-to-int-cast]
> addr->used_user_addr = (uint64_t)svq->vring.used;
> ^
> cc1: all warnings being treated as errors
>
>
> -- PMM
>
>