linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Amery Hung <ameryhung@gmail.com>,
	Sergio Lopez Pascual <slp@redhat.com>,
	 Tyler Fanelli <tfanelli@redhat.com>
Cc: stefanha@redhat.com, mst@redhat.com, jasowang@redhat.com,
	 xuanzhuo@linux.alibaba.com, davem@davemloft.net,
	edumazet@google.com,  kuba@kernel.org, pabeni@redhat.com,
	kys@microsoft.com, haiyangz@microsoft.com,  wei.liu@kernel.org,
	decui@microsoft.com, bryantan@vmware.com,  vdasa@vmware.com,
	pv-drivers@vmware.com, dan.carpenter@linaro.org,
	 simon.horman@corigine.com, oxffffaa@gmail.com,
	kvm@vger.kernel.org,  virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-hyperv@vger.kernel.org,  bpf@vger.kernel.org,
	bobby.eshleman@bytedance.com, jiang.wang@bytedance.com,
	 amery.hung@bytedance.com, xiyou.wangcong@gmail.com
Subject: Re: [RFC PATCH net-next v6 00/14] virtio/vsock: support datagrams
Date: Tue, 29 Jul 2025 14:40:44 +0200	[thread overview]
Message-ID: <CAGxU2F6aObcrixKnbp2PthJDpeQyhzVXwXtfkkQm-8Ni4xenTg@mail.gmail.com> (raw)
In-Reply-To: <CAMB2axNKxW4gnd6qiSNYdm2zPxJkbbLgZz9P-Kh7SS0Sb1Yw=Q@mail.gmail.com>

Hi Amery,

On Sat, 26 Jul 2025 at 07:53, Amery Hung <ameryhung@gmail.com> wrote:
>
> On Tue, Jul 22, 2025 at 7:35 AM Stefano Garzarella <sgarzare@redhat.com> wrote:
> >
> > Hi Amery,
> >
> > On Wed, Jul 10, 2024 at 09:25:41PM +0000, Amery Hung wrote:
> > >Hey all!
> > >
> > >This series introduces support for datagrams to virtio/vsock.
> >
> > any update on v7 of this series?
> >
>
> Hi Stefano,
>
> Sorry that I don't have personal time to work on v7. Since I don't
> think people involved in this set are still working on it, I am
> posting my v7 WIP here to see if anyone is interested in finishing it.
> Would greatly appreciate any help.
>
> Link: https://github.com/ameryhung/linux/tree/vsock-dgram-v7
>
> Here are the things that I haven't address in the WIP:
>
> 01/14
> - Arseniy suggested doing skb_put(dg->payload_size) and memcpy(dg->payload_size)
>
> 07/14
> - Remove the double transport lookup in the send path by passing
> transport to dgram_enqueue
> - Address Arseniy's comment about updating vsock_virtio_transport_common.h
>
> 14/14
> - Split test/vsock into smaller patches
>
> Finally the spec change discussion also needs to happen.

Thanks for the update!
I CCed Sergio and Tyler that may be interested on completing this for
libkrun use case.

Thanks,
Stefano

>
>
>
> > Thanks,
> > Stefano
> >
> > >
> > >It is a spin-off (and smaller version) of this series from the summer:
> > >  https://lore.kernel.org/all/cover.1660362668.git.bobby.eshleman@bytedance.com/
> > >
> > >Please note that this is an RFC and should not be merged until
> > >associated changes are made to the virtio specification, which will
> > >follow after discussion from this series.
> > >
> > >Another aside, the v4 of the series has only been mildly tested with a
> > >run of tools/testing/vsock/vsock_test. Some code likely needs cleaning
> > >up, but I'm hoping to get some of the design choices agreed upon before
> > >spending too much time making it pretty.
> > >
> > >This series first supports datagrams in a basic form for virtio, and
> > >then optimizes the sendpath for all datagram transports.
> > >
> > >The result is a very fast datagram communication protocol that
> > >outperforms even UDP on multi-queue virtio-net w/ vhost on a variety
> > >of multi-threaded workload samples.
> > >
> > >For those that are curious, some summary data comparing UDP and VSOCK
> > >DGRAM (N=5):
> > >
> > >       vCPUS: 16
> > >       virtio-net queues: 16
> > >       payload size: 4KB
> > >       Setup: bare metal + vm (non-nested)
> > >
> > >       UDP: 287.59 MB/s
> > >       VSOCK DGRAM: 509.2 MB/s
> > >
> > >Some notes about the implementation...
> > >
> > >This datagram implementation forces datagrams to self-throttle according
> > >to the threshold set by sk_sndbuf. It behaves similar to the credits
> > >used by streams in its effect on throughput and memory consumption, but
> > >it is not influenced by the receiving socket as credits are.
> > >
> > >The device drops packets silently.
> > >
> > >As discussed previously, this series introduces datagrams and defers
> > >fairness to future work. See discussion in v2 for more context around
> > >datagrams, fairness, and this implementation.
> > >
> > >Signed-off-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
> > >Signed-off-by: Amery Hung <amery.hung@bytedance.com>
> > >---
> > >Changes in v6:
> > >- allow empty transport in datagram vsock
> > >- add empty transport checks in various paths
> > >- transport layer now saves source cid and port to control buffer of skb
> > >  to remove the dependency of transport in recvmsg()
> > >- fix virtio dgram_enqueue() by looking up the transport to be used when
> > >  using sendto(2)
> > >- fix skb memory leaks in two places
> > >- add dgram auto-bind test
> > >- Link to v5: https://lore.kernel.org/r/20230413-b4-vsock-dgram-v5-0-581bd37fdb26@bytedance.com
> > >
> > >Changes in v5:
> > >- teach vhost to drop dgram when a datagram exceeds the receive buffer
> > >  - now uses MSG_ERRQUEUE and depends on Arseniy's zerocopy patch:
> > >       "vsock: read from socket's error queue"
> > >- replace multiple ->dgram_* callbacks with single ->dgram_addr_init()
> > >  callback
> > >- refactor virtio dgram skb allocator to reduce conflicts w/ zerocopy series
> > >- add _fallback/_FALLBACK suffix to dgram transport variables/macros
> > >- add WARN_ONCE() for table_size / VSOCK_HASH issue
> > >- add static to vsock_find_bound_socket_common
> > >- dedupe code in vsock_dgram_sendmsg() using module_got var
> > >- drop concurrent sendmsg() for dgram and defer to future series
> > >- Add more tests
> > >  - test EHOSTUNREACH in errqueue
> > >  - test stream + dgram address collision
> > >- improve clarity of dgram msg bounds test code
> > >- Link to v4: https://lore.kernel.org/r/20230413-b4-vsock-dgram-v4-0-0cebbb2ae899@bytedance.com
> > >
> > >Changes in v4:
> > >- style changes
> > >  - vsock: use sk_vsock(vsk) in vsock_dgram_recvmsg instead of
> > >    &sk->vsk
> > >  - vsock: fix xmas tree declaration
> > >  - vsock: fix spacing issues
> > >  - virtio/vsock: virtio_transport_recv_dgram returns void because err
> > >    unused
> > >- sparse analysis warnings/errors
> > >  - virtio/vsock: fix unitialized skerr on destroy
> > >  - virtio/vsock: fix uninitialized err var on goto out
> > >  - vsock: fix declarations that need static
> > >  - vsock: fix __rcu annotation order
> > >- bugs
> > >  - vsock: fix null ptr in remote_info code
> > >  - vsock/dgram: make transport_dgram a fallback instead of first
> > >    priority
> > >  - vsock: remove redundant rcu read lock acquire in getname()
> > >- tests
> > >  - add more tests (message bounds and more)
> > >  - add vsock_dgram_bind() helper
> > >  - add vsock_dgram_connect() helper
> > >
> > >Changes in v3:
> > >- Support multi-transport dgram, changing logic in connect/bind
> > >  to support VMCI case
> > >- Support per-pkt transport lookup for sendto() case
> > >- Fix dgram_allow() implementation
> > >- Fix dgram feature bit number (now it is 3)
> > >- Fix binding so dgram and connectible (cid,port) spaces are
> > >  non-overlapping
> > >- RCU protect transport ptr so connect() calls never leave
> > >  a lockless read of the transport and remote_addr are always
> > >  in sync
> > >- Link to v2: https://lore.kernel.org/r/20230413-b4-vsock-dgram-v2-0-079cc7cee62e@bytedance.com
> > >
> > >
> > >Bobby Eshleman (14):
> > >  af_vsock: generalize vsock_dgram_recvmsg() to all transports
> > >  af_vsock: refactor transport lookup code
> > >  af_vsock: support multi-transport datagrams
> > >  af_vsock: generalize bind table functions
> > >  af_vsock: use a separate dgram bind table
> > >  virtio/vsock: add VIRTIO_VSOCK_TYPE_DGRAM
> > >  virtio/vsock: add common datagram send path
> > >  af_vsock: add vsock_find_bound_dgram_socket()
> > >  virtio/vsock: add common datagram recv path
> > >  virtio/vsock: add VIRTIO_VSOCK_F_DGRAM feature bit
> > >  vhost/vsock: implement datagram support
> > >  vsock/loopback: implement datagram support
> > >  virtio/vsock: implement datagram support
> > >  test/vsock: add vsock dgram tests
> > >
> > > drivers/vhost/vsock.c                   |   62 +-
> > > include/linux/virtio_vsock.h            |    9 +-
> > > include/net/af_vsock.h                  |   24 +-
> > > include/uapi/linux/virtio_vsock.h       |    2 +
> > > net/vmw_vsock/af_vsock.c                |  343 ++++++--
> > > net/vmw_vsock/hyperv_transport.c        |   13 -
> > > net/vmw_vsock/virtio_transport.c        |   24 +-
> > > net/vmw_vsock/virtio_transport_common.c |  188 ++++-
> > > net/vmw_vsock/vmci_transport.c          |   61 +-
> > > net/vmw_vsock/vsock_loopback.c          |    9 +-
> > > tools/testing/vsock/util.c              |  177 +++-
> > > tools/testing/vsock/util.h              |   10 +
> > > tools/testing/vsock/vsock_test.c        | 1032 ++++++++++++++++++++---
> > > 13 files changed, 1638 insertions(+), 316 deletions(-)
> > >
> > >--
> > >2.20.1
> > >
> >
>


      reply	other threads:[~2025-07-29 12:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10 21:25 [RFC PATCH net-next v6 00/14] virtio/vsock: support datagrams Amery Hung
2024-07-10 21:25 ` [RFC PATCH net-next v6 01/14] af_vsock: generalize vsock_dgram_recvmsg() to all transports Amery Hung
2024-07-15  8:02   ` Luigi Leonardi
2024-07-15 23:39     ` Amery Hung
2024-07-29 19:25   ` Arseniy Krasnov
2024-07-10 21:25 ` [RFC PATCH net-next v6 02/14] af_vsock: refactor transport lookup code Amery Hung
2024-07-25  6:29   ` Arseniy Krasnov
2024-07-28 22:10     ` Amery Hung
2024-07-10 21:25 ` [RFC PATCH net-next v6 03/14] af_vsock: support multi-transport datagrams Amery Hung
2024-07-15  8:13   ` Arseniy Krasnov
2024-07-15 17:41     ` Amery Hung
2024-07-28 20:28   ` Arseniy Krasnov
2024-07-28 21:53     ` Amery Hung
2024-07-29  5:12       ` Arseniy Krasnov
2024-07-10 21:25 ` [RFC PATCH net-next v6 04/14] af_vsock: generalize bind table functions Amery Hung
2024-07-23 14:39   ` Stefano Garzarella
2024-07-28 18:52     ` Amery Hung
2024-07-30  8:00       ` Stefano Garzarella
2024-07-30 17:56         ` Amery Hung
2024-07-10 21:25 ` [RFC PATCH net-next v6 05/14] af_vsock: use a separate dgram bind table Amery Hung
2024-07-23 14:41   ` Stefano Garzarella
2024-07-28 21:37     ` Amery Hung
2024-07-30  8:05       ` Stefano Garzarella
2024-07-10 21:25 ` [RFC PATCH net-next v6 06/14] virtio/vsock: add VIRTIO_VSOCK_TYPE_DGRAM Amery Hung
2024-07-10 21:25 ` [RFC PATCH net-next v6 07/14] virtio/vsock: add common datagram send path Amery Hung
2024-07-23 14:42   ` Stefano Garzarella
2024-07-26 23:22     ` Amery Hung
2024-07-30  8:22       ` Stefano Garzarella
2024-07-29 20:00   ` Arseniy Krasnov
2024-07-29 22:51     ` Amery Hung
2024-07-30  5:09       ` Arseniy Krasnov
2024-07-10 21:25 ` [RFC PATCH net-next v6 08/14] af_vsock: add vsock_find_bound_dgram_socket() Amery Hung
2024-07-10 21:25 ` [RFC PATCH net-next v6 09/14] virtio/vsock: add common datagram recv path Amery Hung
2024-07-23 14:42   ` Stefano Garzarella
2024-07-30  0:35     ` Amery Hung
2024-07-30  8:32       ` Stefano Garzarella
2024-07-10 21:25 ` [RFC PATCH net-next v6 10/14] virtio/vsock: add VIRTIO_VSOCK_F_DGRAM feature bit Amery Hung
2024-07-10 21:25 ` [RFC PATCH net-next v6 11/14] vhost/vsock: implement datagram support Amery Hung
2024-07-10 21:25 ` [RFC PATCH net-next v6 12/14] vsock/loopback: " Amery Hung
2024-08-01 12:18   ` Luigi Leonardi
2024-07-10 21:25 ` [RFC PATCH net-next v6 13/14] virtio/vsock: " Amery Hung
2024-07-11 23:02   ` Luigi Leonardi
2024-07-11 23:07     ` Amery Hung
2024-07-10 21:25 ` [RFC PATCH net-next v6 14/14] test/vsock: add vsock dgram tests Amery Hung
2024-07-20 19:58   ` Arseniy Krasnov
2024-07-23 14:43   ` Stefano Garzarella
2024-07-28 22:06     ` Amery Hung
2024-07-23 14:38 ` [RFC PATCH net-next v6 00/14] virtio/vsock: support datagrams Stefano Garzarella
2025-07-22 14:35 ` Stefano Garzarella
2025-07-26  5:53   ` Amery Hung
2025-07-29 12:40     ` Stefano Garzarella [this message]

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=CAGxU2F6aObcrixKnbp2PthJDpeQyhzVXwXtfkkQm-8Ni4xenTg@mail.gmail.com \
    --to=sgarzare@redhat.com \
    --cc=amery.hung@bytedance.com \
    --cc=ameryhung@gmail.com \
    --cc=bobby.eshleman@bytedance.com \
    --cc=bpf@vger.kernel.org \
    --cc=bryantan@vmware.com \
    --cc=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=jasowang@redhat.com \
    --cc=jiang.wang@bytedance.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=oxffffaa@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pv-drivers@vmware.com \
    --cc=simon.horman@corigine.com \
    --cc=slp@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=tfanelli@redhat.com \
    --cc=vdasa@vmware.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wei.liu@kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    --cc=xuanzhuo@linux.alibaba.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).