"Alexei Starovoitov" <[email protected]> writes:
> On Wed, Oct 28, 2026 at 09:04 AM Sergio Lopez <[email protected]> wrote: >> This series implements SOCK_DGRAM support for virtio-vsock and >> vhost-vsock, allowing applications to exchange connectionless messages >> through the existing AF_VSOCK datagram API. > > The cover doesn't say who needs it. > > Bobby and Amery took the same feature to v6: > https://lore.kernel.org/all/[email protected]/ > Stefano said there that it can work well and that the virtio spec change > is the next step. The last mails of the thread have Amery's v7 WIP and a > short list of what is left. > The cover doesn't mention it. The spec change is still missing. > > Why not finish v7 instead ? The previous series is more that two years old, and vsock has changed significantly since then. I thought this deserved a complete refresh. I should have linked the old series in the cover, though. I'll do that in v2. As for the spec, I asked Stefano and we agreed it'd be better to have a series that's pretty close to be merged before sending the spec change, and I agree that's a good idea. In fact, adopting SEQPACKET's strategy for splitting up packets in the vq would have an impact on the spec. > This RFC goes the other way in these places: > > what v6 this RFC > ----------------- ------------------------ ---------------------------- > (cid, port) space own bind table for dgram shared with stream. The 2nd > bind() gets EADDRINUSE > vsk->transport empty until connect(), g2h or h2g, picked in > lookup per packet socket(). -ENODEV with > vsock_loopback only > routing one helper for stream 2nd copy of the chain in > and dgram vsock_assign_transport() > recvmsg() in af_vsock.c, dgram_dequeue() stays, > no dgram_dequeue() dgram_payload_len() is new > VMCI fallback first. No virtio dgram when > its module is loaded > dgram > RX buffer drop, EHOSTUNREACH in every RX buffer is 64K > the error queue > >> Datagrams use destination-based routing across guest-to-host, >> host-to-guest and loopback transports while retaining the socket's >> transport state. VMCI keeps priority as the dedicated datagram > > A dgram socket uses two members of struct virtio_vsock_sock: tx_lock and > bytes_unsent. They serve SIOCOUTQ only. > virtio_transport_alloc_skb() does skb_set_owner_w() already. > udp_ioctl() returns sk_wmem_alloc_get() for SIOCOUTQ. > > Without them a dgram socket has no transport state, like in v6. > Then no need for the owner transport, dgram_transport_match(), > fallback_transport, tx_accounted, the skb destructor, etc. > >> transport. Guest RX buffers accommodate complete messages when >> datagrams are negotiated, preserving message boundaries. > > That's 64K per RX buffer instead of 4K, for stream and seqpacket too. > It undoes commit 03a92f036a04 ("vsock/virtio: Resize receive buffers so > that each SKB fits in a 4K page"). > > pskb_trim_unique() doesn't reduce skb->truesize. So a datagram of 1 byte > charges more than 64K to sk_rmem_alloc of the guest socket. > The default sk_rcvbuf is about 208K on x86-64. The 5th datagram in the > queue is dropped. Thanks for the review, I'm putting together a v2 addressing these concerns. Cheers, Sergio.
