mbox

[PULL,00/24] Net Patches

Message ID 20220719131637.46131-1-jasowang@redhat.com (mailing list archive)
State New, archived
Headers show

Pull-request

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

Message

Jason Wang July 19, 2022, 1:16 p.m. UTC
The following changes since commit f9d9fff72eed03acde97ea2d66104748dc474b2e:

  Merge tag 'qemu-sparc-20220718' of https://github.com/mcayland/qemu into staging (2022-07-19 09:57:13 +0100)

are available in the git repository at:

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

for you to fetch changes up to f8a9fd7b7ab6601b76e253bbcbfe952f8c1887ec:

  net/colo.c: fix segmentation fault when packet is not parsed correctly (2022-07-19 21:05:20 +0800)

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

----------------------------------------------------------------
Eugenio PĂ©rez (20):
      vhost: move descriptor translation to vhost_svq_vring_write_descs
      virtio-net: Expose MAC_TABLE_ENTRIES
      virtio-net: Expose ctrl virtqueue logic
      vdpa: Avoid compiler to squash reads to used idx
      vhost: Reorder vhost_svq_kick
      vhost: Move vhost_svq_kick call to vhost_svq_add
      vhost: Check for queue full at vhost_svq_add
      vhost: Decouple vhost_svq_add from VirtQueueElement
      vhost: Add SVQDescState
      vhost: Track number of descs in SVQDescState
      vhost: add vhost_svq_push_elem
      vhost: Expose vhost_svq_add
      vhost: add vhost_svq_poll
      vhost: Add svq avail_handler callback
      vdpa: Export vhost_vdpa_dma_map and unmap calls
      vdpa: manual forward CVQ buffers
      vdpa: Buffer CVQ support on shadow virtqueue
      vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs
      vdpa: Add device migration blocker
      vdpa: Add x-svq to NetdevVhostVDPAOptions

Zhang Chen (4):
      softmmu/runstate.c: add RunStateTransition support form COLO to PRELAUNCH
      net/colo: Fix a "double free" crash to clear the conn_list
      net/colo.c: No need to track conn_list for filter-rewriter
      net/colo.c: fix segmentation fault when packet is not parsed correctly

 hw/net/virtio-net.c                |  85 +++++----
 hw/virtio/vhost-shadow-virtqueue.c | 210 +++++++++++++++-------
 hw/virtio/vhost-shadow-virtqueue.h |  52 +++++-
 hw/virtio/vhost-vdpa.c             |  26 ++-
 include/hw/virtio/vhost-vdpa.h     |   8 +
 include/hw/virtio/virtio-net.h     |   7 +
 net/colo-compare.c                 |   2 +-
 net/colo.c                         |  11 +-
 net/filter-rewriter.c              |   2 +-
 net/trace-events                   |   1 +
 net/vhost-vdpa.c                   | 357 +++++++++++++++++++++++++++++++++++--
 qapi/net.json                      |   9 +-
 softmmu/runstate.c                 |   1 +
 13 files changed, 648 insertions(+), 123 deletions(-)

Comments

Peter Maydell July 19, 2022, 4:40 p.m. UTC | #1
On Tue, 19 Jul 2022 at 14:17, Jason Wang <jasowang@redhat.com> wrote:
>
> The following changes since commit f9d9fff72eed03acde97ea2d66104748dc474b2e:
>
>   Merge tag 'qemu-sparc-20220718' of https://github.com/mcayland/qemu into staging (2022-07-19 09:57:13 +0100)
>
> are available in the git repository at:
>
>   https://github.com/jasowang/qemu.git tags/net-pull-request
>
> for you to fetch changes up to f8a9fd7b7ab6601b76e253bbcbfe952f8c1887ec:
>
>   net/colo.c: fix segmentation fault when packet is not parsed correctly (2022-07-19 21:05:20 +0800)
>
> ----------------------------------------------------------------
>
> ----------------------------------------------------------------

Fails to build, many platforms:

eg
https://gitlab.com/qemu-project/qemu/-/jobs/2742242194

libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cvq_unmap_buf':
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:234: undefined
reference to `vhost_iova_tree_find_iova'
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:242: undefined
reference to `vhost_vdpa_dma_unmap'
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:247: undefined
reference to `vhost_iova_tree_remove'
libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cleanup':
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:163: undefined
reference to `vhost_iova_tree_delete'
libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cvq_map_buf':
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:285: undefined
reference to `vhost_iova_tree_map_alloc'
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:291: undefined
reference to `vhost_vdpa_dma_map'
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:300: undefined
reference to `vhost_iova_tree_remove'
libcommon.fa.p/net_vhost-vdpa.c.o: In function
`vhost_vdpa_net_handle_ctrl_avail':
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:445: undefined
reference to `vhost_svq_push_elem'
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:408: undefined
reference to `vhost_svq_add'
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:422: undefined
reference to `vhost_svq_poll'
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:434: undefined
reference to `virtio_net_handle_ctrl_iov'
libcommon.fa.p/net_vhost-vdpa.c.o: In function `net_init_vhost_vdpa':
/builds/qemu-project/qemu/build/../net/vhost-vdpa.c:611: undefined
reference to `vhost_iova_tree_new'
libcommon.fa.p/net_vhost-vdpa.c.o: In function
`glib_autoptr_cleanup_VhostIOVATree':
/builds/qemu-project/qemu/hw/virtio/vhost-iova-tree.h:20: undefined
reference to `vhost_iova_tree_delete'
collect2: error: ld returned 1 exit status
[2436/4108] Compiling C object
libqemu-s390x-softmmu.fa.p/meson-generated_.._qapi_qapi-introspect.c.o



Presumably the conditions in the various meson.build files are
out of sync about when to build the net/vhost-vdpa.c code vs
the code that's implementing the functions it's trying to call.

Specifically, the functions being called will only be present
if the target architecture has CONFIG_VIRTIO, which isn't
guaranteed, but we try to link the vhost-vdpa code in anyway.

thanks
-- PMM
Jason Wang July 20, 2022, 3:40 a.m. UTC | #2
On Wed, Jul 20, 2022 at 12:40 AM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Tue, 19 Jul 2022 at 14:17, Jason Wang <jasowang@redhat.com> wrote:
> >
> > The following changes since commit f9d9fff72eed03acde97ea2d66104748dc474b2e:
> >
> >   Merge tag 'qemu-sparc-20220718' of https://github.com/mcayland/qemu into staging (2022-07-19 09:57:13 +0100)
> >
> > are available in the git repository at:
> >
> >   https://github.com/jasowang/qemu.git tags/net-pull-request
> >
> > for you to fetch changes up to f8a9fd7b7ab6601b76e253bbcbfe952f8c1887ec:
> >
> >   net/colo.c: fix segmentation fault when packet is not parsed correctly (2022-07-19 21:05:20 +0800)
> >
> > ----------------------------------------------------------------
> >
> > ----------------------------------------------------------------
>
> Fails to build, many platforms:
>
> eg
> https://gitlab.com/qemu-project/qemu/-/jobs/2742242194
>
> libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cvq_unmap_buf':
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:234: undefined
> reference to `vhost_iova_tree_find_iova'
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:242: undefined
> reference to `vhost_vdpa_dma_unmap'
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:247: undefined
> reference to `vhost_iova_tree_remove'
> libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cleanup':
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:163: undefined
> reference to `vhost_iova_tree_delete'
> libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cvq_map_buf':
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:285: undefined
> reference to `vhost_iova_tree_map_alloc'
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:291: undefined
> reference to `vhost_vdpa_dma_map'
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:300: undefined
> reference to `vhost_iova_tree_remove'
> libcommon.fa.p/net_vhost-vdpa.c.o: In function
> `vhost_vdpa_net_handle_ctrl_avail':
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:445: undefined
> reference to `vhost_svq_push_elem'
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:408: undefined
> reference to `vhost_svq_add'
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:422: undefined
> reference to `vhost_svq_poll'
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:434: undefined
> reference to `virtio_net_handle_ctrl_iov'
> libcommon.fa.p/net_vhost-vdpa.c.o: In function `net_init_vhost_vdpa':
> /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:611: undefined
> reference to `vhost_iova_tree_new'
> libcommon.fa.p/net_vhost-vdpa.c.o: In function
> `glib_autoptr_cleanup_VhostIOVATree':
> /builds/qemu-project/qemu/hw/virtio/vhost-iova-tree.h:20: undefined
> reference to `vhost_iova_tree_delete'
> collect2: error: ld returned 1 exit status
> [2436/4108] Compiling C object
> libqemu-s390x-softmmu.fa.p/meson-generated_.._qapi_qapi-introspect.c.o
>
>
>
> Presumably the conditions in the various meson.build files are
> out of sync about when to build the net/vhost-vdpa.c code vs
> the code that's implementing the functions it's trying to call.
>
> Specifically, the functions being called will only be present
> if the target architecture has CONFIG_VIRTIO, which isn't
> guaranteed, but we try to link the vhost-vdpa code in anyway.

Right, this is probably because vhost-vdpa start to use virtio loigc (cvq).

Eugenio, please fix this and I will send a new version of the pull request.

Thanks

>
> thanks
> -- PMM
>
Eugenio Perez Martin July 20, 2022, 6:02 a.m. UTC | #3
On Wed, Jul 20, 2022 at 5:40 AM Jason Wang <jasowang@redhat.com> wrote:
>
> On Wed, Jul 20, 2022 at 12:40 AM Peter Maydell <peter.maydell@linaro.org> wrote:
> >
> > On Tue, 19 Jul 2022 at 14:17, Jason Wang <jasowang@redhat.com> wrote:
> > >
> > > The following changes since commit f9d9fff72eed03acde97ea2d66104748dc474b2e:
> > >
> > >   Merge tag 'qemu-sparc-20220718' of https://github.com/mcayland/qemu into staging (2022-07-19 09:57:13 +0100)
> > >
> > > are available in the git repository at:
> > >
> > >   https://github.com/jasowang/qemu.git tags/net-pull-request
> > >
> > > for you to fetch changes up to f8a9fd7b7ab6601b76e253bbcbfe952f8c1887ec:
> > >
> > >   net/colo.c: fix segmentation fault when packet is not parsed correctly (2022-07-19 21:05:20 +0800)
> > >
> > > ----------------------------------------------------------------
> > >
> > > ----------------------------------------------------------------
> >
> > Fails to build, many platforms:
> >
> > eg
> > https://gitlab.com/qemu-project/qemu/-/jobs/2742242194
> >
> > libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cvq_unmap_buf':
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:234: undefined
> > reference to `vhost_iova_tree_find_iova'
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:242: undefined
> > reference to `vhost_vdpa_dma_unmap'
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:247: undefined
> > reference to `vhost_iova_tree_remove'
> > libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cleanup':
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:163: undefined
> > reference to `vhost_iova_tree_delete'
> > libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cvq_map_buf':
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:285: undefined
> > reference to `vhost_iova_tree_map_alloc'
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:291: undefined
> > reference to `vhost_vdpa_dma_map'
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:300: undefined
> > reference to `vhost_iova_tree_remove'
> > libcommon.fa.p/net_vhost-vdpa.c.o: In function
> > `vhost_vdpa_net_handle_ctrl_avail':
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:445: undefined
> > reference to `vhost_svq_push_elem'
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:408: undefined
> > reference to `vhost_svq_add'
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:422: undefined
> > reference to `vhost_svq_poll'
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:434: undefined
> > reference to `virtio_net_handle_ctrl_iov'
> > libcommon.fa.p/net_vhost-vdpa.c.o: In function `net_init_vhost_vdpa':
> > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:611: undefined
> > reference to `vhost_iova_tree_new'
> > libcommon.fa.p/net_vhost-vdpa.c.o: In function
> > `glib_autoptr_cleanup_VhostIOVATree':
> > /builds/qemu-project/qemu/hw/virtio/vhost-iova-tree.h:20: undefined
> > reference to `vhost_iova_tree_delete'
> > collect2: error: ld returned 1 exit status
> > [2436/4108] Compiling C object
> > libqemu-s390x-softmmu.fa.p/meson-generated_.._qapi_qapi-introspect.c.o
> >
> >
> >
> > Presumably the conditions in the various meson.build files are
> > out of sync about when to build the net/vhost-vdpa.c code vs
> > the code that's implementing the functions it's trying to call.
> >
> > Specifically, the functions being called will only be present
> > if the target architecture has CONFIG_VIRTIO, which isn't
> > guaranteed, but we try to link the vhost-vdpa code in anyway.
>
> Right, this is probably because vhost-vdpa start to use virtio loigc (cvq).
>
> Eugenio, please fix this and I will send a new version of the pull request.
>

Is the right solution to build vhost-vdpa.c only if CONFIG_VIRTIO_NET
is defined?

It would make it equal as vhost_net_user in net/meson.buikd:
if have_vhost_net_user
  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true:
files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
endif

vs

if have_vhost_net_vdpa
  softmmu_ss.add(files('vhost-vdpa.c'))
endif

Or that would be considered as a regression? The other solution would
be to add vhost-shadow-virtqueue-stub.c and make these functions
return -ENOTSUP and similar.

Thanks!
Jason Wang July 20, 2022, 6:06 a.m. UTC | #4
On Wed, Jul 20, 2022 at 2:03 PM Eugenio Perez Martin
<eperezma@redhat.com> wrote:
>
> On Wed, Jul 20, 2022 at 5:40 AM Jason Wang <jasowang@redhat.com> wrote:
> >
> > On Wed, Jul 20, 2022 at 12:40 AM Peter Maydell <peter.maydell@linaro.org> wrote:
> > >
> > > On Tue, 19 Jul 2022 at 14:17, Jason Wang <jasowang@redhat.com> wrote:
> > > >
> > > > The following changes since commit f9d9fff72eed03acde97ea2d66104748dc474b2e:
> > > >
> > > >   Merge tag 'qemu-sparc-20220718' of https://github.com/mcayland/qemu into staging (2022-07-19 09:57:13 +0100)
> > > >
> > > > are available in the git repository at:
> > > >
> > > >   https://github.com/jasowang/qemu.git tags/net-pull-request
> > > >
> > > > for you to fetch changes up to f8a9fd7b7ab6601b76e253bbcbfe952f8c1887ec:
> > > >
> > > >   net/colo.c: fix segmentation fault when packet is not parsed correctly (2022-07-19 21:05:20 +0800)
> > > >
> > > > ----------------------------------------------------------------
> > > >
> > > > ----------------------------------------------------------------
> > >
> > > Fails to build, many platforms:
> > >
> > > eg
> > > https://gitlab.com/qemu-project/qemu/-/jobs/2742242194
> > >
> > > libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cvq_unmap_buf':
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:234: undefined
> > > reference to `vhost_iova_tree_find_iova'
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:242: undefined
> > > reference to `vhost_vdpa_dma_unmap'
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:247: undefined
> > > reference to `vhost_iova_tree_remove'
> > > libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cleanup':
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:163: undefined
> > > reference to `vhost_iova_tree_delete'
> > > libcommon.fa.p/net_vhost-vdpa.c.o: In function `vhost_vdpa_cvq_map_buf':
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:285: undefined
> > > reference to `vhost_iova_tree_map_alloc'
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:291: undefined
> > > reference to `vhost_vdpa_dma_map'
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:300: undefined
> > > reference to `vhost_iova_tree_remove'
> > > libcommon.fa.p/net_vhost-vdpa.c.o: In function
> > > `vhost_vdpa_net_handle_ctrl_avail':
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:445: undefined
> > > reference to `vhost_svq_push_elem'
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:408: undefined
> > > reference to `vhost_svq_add'
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:422: undefined
> > > reference to `vhost_svq_poll'
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:434: undefined
> > > reference to `virtio_net_handle_ctrl_iov'
> > > libcommon.fa.p/net_vhost-vdpa.c.o: In function `net_init_vhost_vdpa':
> > > /builds/qemu-project/qemu/build/../net/vhost-vdpa.c:611: undefined
> > > reference to `vhost_iova_tree_new'
> > > libcommon.fa.p/net_vhost-vdpa.c.o: In function
> > > `glib_autoptr_cleanup_VhostIOVATree':
> > > /builds/qemu-project/qemu/hw/virtio/vhost-iova-tree.h:20: undefined
> > > reference to `vhost_iova_tree_delete'
> > > collect2: error: ld returned 1 exit status
> > > [2436/4108] Compiling C object
> > > libqemu-s390x-softmmu.fa.p/meson-generated_.._qapi_qapi-introspect.c.o
> > >
> > >
> > >
> > > Presumably the conditions in the various meson.build files are
> > > out of sync about when to build the net/vhost-vdpa.c code vs
> > > the code that's implementing the functions it's trying to call.
> > >
> > > Specifically, the functions being called will only be present
> > > if the target architecture has CONFIG_VIRTIO, which isn't
> > > guaranteed, but we try to link the vhost-vdpa code in anyway.
> >
> > Right, this is probably because vhost-vdpa start to use virtio loigc (cvq).
> >
> > Eugenio, please fix this and I will send a new version of the pull request.
> >
>
> Is the right solution to build vhost-vdpa.c only if CONFIG_VIRTIO_NET
> is defined?

If you meant net/vhost-vdpa.c. I think so, since we're using cvq logic
in virtio-net.c.

>
> It would make it equal as vhost_net_user in net/meson.buikd:
> if have_vhost_net_user
>   softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true:
> files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
>   softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
> endif
>
> vs
>
> if have_vhost_net_vdpa
>   softmmu_ss.add(files('vhost-vdpa.c'))
> endif
>
> Or that would be considered as a regression?

Probably not since the compilation is not broken.

> The other solution would
> be to add vhost-shadow-virtqueue-stub.c and make these functions
> return -ENOTSUP and similar.

Either should be fine, just choose the one that is easier.

Thanks

>
> Thanks!
>