All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: cong.wang@bytedance.com,
	Xiongchun Duan <duanxiongchun@bytedance.com>,
	"Jiang Wang ." <jiang.wang@bytedance.com>,
	cohuck@redhat.com, virtualization@lists.linux-foundation.org,
	xieyongji@bytedance.com, Stefan Hajnoczi <stefanha@redhat.com>,
	Arseny Krasnov <arseny.krasnov@kaspersky.com>,
	asias@redhat.com
Subject: Re: [RFC v2] virtio-vsock: add description for datagram type
Date: Tue, 13 Apr 2021 09:16:50 -0400	[thread overview]
Message-ID: <20210413091251-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20210413125853.2dkldmp23vkkc74c@steredhat>

On Tue, Apr 13, 2021 at 02:58:53PM +0200, Stefano Garzarella wrote:
> On Mon, Apr 12, 2021 at 03:42:23PM -0700, Jiang Wang . wrote:
> > On Mon, Apr 12, 2021 at 7:21 AM Stefano Garzarella <sgarzare@redhat.com> wrote:
> > > 
> > > On Mon, Apr 12, 2021 at 02:50:17PM +0100, Stefan Hajnoczi wrote:
> > > >On Thu, Apr 01, 2021 at 04:36:02AM +0000, jiang.wang wrote:
> > > >> Add supports for datagram type for virtio-vsock. Datagram
> > > >> sockets are connectionless and unreliable. To avoid contention
> > > >> with stream and other sockets, add two more virtqueues and
> > > >> a new feature bit to identify if those two new queues exist or not.
> > > >>
> > > >> Also add descriptions for resource management of datagram, which
> > > >> does not use the existing credit update mechanism associated with
> > > >> stream sockets.
> > > >>
> > > >> Signed-off-by: Jiang Wang <jiang.wang@bytedance.com>
> > > >> ---
> > > >> V2 addressed the comments for the previous version.
> > > >>
> > > >>  virtio-vsock.tex | 62 +++++++++++++++++++++++++++++++++++++++++++++++---------
> > > >>  1 file changed, 52 insertions(+), 10 deletions(-)
> > > >>
> > > >> diff --git a/virtio-vsock.tex b/virtio-vsock.tex
> > > >> index da7e641..62c12e0 100644
> > > >> --- a/virtio-vsock.tex
> > > >> +++ b/virtio-vsock.tex
> > > >> @@ -11,12 +11,25 @@ \subsection{Virtqueues}\label{sec:Device Types / Socket Device / Virtqueues}
> > > >>  \begin{description}
> > > >>  \item[0] rx
> > > >>  \item[1] tx
> > > >> +\item[2] datagram rx
> > > >> +\item[3] datagram tx
> > > >> +\item[4] event
> > > >> +\end{description}
> > > >> +The virtio socket device uses 5 queues if feature bit VIRTIO_VSOCK_F_DRGAM is set. Otherwise, it
> > > >> +only uses 3 queues, as the following. Rx and tx queues are always used for stream sockets.
> > > >> +
> > > >> +\begin{description}
> > > >> +\item[0] rx
> > > >> +\item[1] tx
> > > >>  \item[2] event
> > > >>  \end{description}
> > > >>
> > > >
> > > >I suggest renaming "rx" and "tx" to "stream rx" and "stream tx"
> > > >virtqueues and also adding this:
> > > >
> > > >  When behavior differs between stream and datagram rx/tx virtqueues
> > > >  their full names are used. Common behavior is simply described in
> > > >  terms of rx/tx virtqueues and applies to both stream and datagram
> > > >  virtqueues.
> > > >
> > > >This way you won't need to duplicate portions of the spec that deal with
> > > >populating the virtqueues, for example.
> > > >
> > > >It's also clearer to use a full name for stream rx/tx virtqueues instead
> > > >of calling them rx/tx virtqueues now that we have datagram rx/tx
> > > >virtqueues.
> > > >
> > > >> +
> > > >>  \subsection{Feature bits}\label{sec:Device Types / Socket Device / Feature bits}
> > > >>
> > > >> -There are currently no feature bits defined for this device.
> > > >> +\begin{description}
> > > >> +\item[VIRTIO_VSOCK_F_DGRAM (0)] Device has support for datagram socket type.
> > > >> +\end{description}
> > > >>
> > > >>  \subsection{Device configuration layout}\label{sec:Device Types / Socket Device / Device configuration layout}
> > > >>
> > > >> @@ -107,6 +120,9 @@ \subsection{Device Operation}\label{sec:Device Types / Socket Device / Device Op
> > > >>
> > > >>  \subsubsection{Virtqueue Flow Control}\label{sec:Device Types / Socket Device / Device Operation / Virtqueue Flow Control}
> > > >>
> > > >> +Flow control applies to stream sockets; datagram sockets do not have
> > > >> +flow control.
> > > >> +
> > > >>  The tx virtqueue carries packets initiated by applications and replies to
> > > >>  received packets.  The rx virtqueue carries packets initiated by the device and
> > > >>  replies to previously transmitted packets.
> > > >> @@ -140,12 +156,15 @@ \subsubsection{Addressing}\label{sec:Device Types / Socket Device / Device Opera
> > > >>  consists of a (cid, port number) tuple. The header fields used for this are
> > > >>  \field{src_cid}, \field{src_port}, \field{dst_cid}, and \field{dst_port}.
> > > >>
> > > >> -Currently only stream sockets are supported. \field{type} is 1 for stream
> > > >> -socket types.
> > > >> +Currently stream and datagram (dgram) sockets are supported. \field{type} is 1 for stream
> > > >> +socket types. \field{type} is 3 for dgram socket types.
> > > >>
> > > >>  Stream sockets provide in-order, guaranteed, connection-oriented delivery
> > > >>  without message boundaries.
> > > >>
> > > >> +Datagram sockets provide connectionless unreliable messages of
> > > >> +a fixed maximum length.
> > > >
> > > >Plus unordered (?) and with message boundaries. In other words:
> > > >
> > > >  Datagram sockets provide unordered, unreliable, connectionless message
> > > >  with message boundaries and a fixed maximum length.
> > > >
> > > >I didn't think of the fixed maximum length aspect before. I guess the
> > > >intention is that the rx buffer size is the message size limit? That's
> > > >different from UDP messages, which can be fragmented into multiple IP
> > > >packets and can be larger than 64KiB:
> > > >https://en.wikipedia.org/wiki/User_Datagram_Protocol#UDP_datagram_structure
> > > >
> > > >Is it possible to support large datagram messages in vsock? I'm a little
> > > >concerned that applications that run successfully over UDP will not be
> > > >portable if vsock has this limitation because it would impose extra
> > > >message boundaries that the application protocol might not tolerate.
> > > 
> > > Maybe we can reuse the same approach Arseny is using for SEQPACKET.
> > > Fragment the packets according to the buffers in the virtqueue and set
> > > the EOR flag to indicate the last packet in the message.
> > > 
> > Agree. Another option is to use the ones for skb since we may need to
> > use skbs for multiple transport support anyway.
> > 
> 
> The important thing I think is to have a single flag in virtio-vsock that
> identifies pretty much the same thing: this is the last fragment of a series
> to rebuild a packet.
> 
> We should reuse the same flag for DGRAM and SEQPACKET.
> 
> Thanks,
> Stefano

Well DGRAM can drop data so I wonder whether it can work ...

-- 
MST

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-04-13 13:17 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  4:36 [RFC v2] virtio-vsock: add description for datagram type jiang.wang
2021-04-12 13:50 ` Stefan Hajnoczi
2021-04-12 14:21   ` Stefano Garzarella
2021-04-12 22:42     ` Jiang Wang .
2021-04-13 12:58       ` Stefano Garzarella
2021-04-13 13:16         ` Michael S. Tsirkin [this message]
2021-04-13 13:38           ` Stefano Garzarella
2021-04-13 13:50             ` Michael S. Tsirkin
2021-04-13 14:03               ` Stefano Garzarella
2021-04-13 19:58                 ` Michael S. Tsirkin
2021-04-13 22:00                   ` Jiang Wang .
2021-04-14  7:07                     ` Stefano Garzarella
2021-04-14  6:57                   ` Stefano Garzarella
2021-04-14  7:20                     ` Michael S. Tsirkin
2021-04-14  9:38                       ` Stefano Garzarella
2021-04-15  3:15                         ` Jiang Wang .
2021-05-04  3:40                           ` Jiang Wang .
2021-05-04 16:16                             ` Stefano Garzarella
2021-05-04 17:06                               ` Jiang Wang .
2021-05-05 10:49                                 ` Stefano Garzarella
2021-05-05 16:58                                   ` Jiang Wang .
2021-05-07 16:53                                     ` Jiang Wang .
2021-05-10 14:50                                       ` Stefano Garzarella
2021-05-13 23:26                                         ` Jiang Wang .
2021-05-14 15:17                                           ` Stefano Garzarella
2021-05-14 18:55                                             ` Jiang Wang .
2021-05-17 11:02                                               ` Stefano Garzarella
2021-05-18  6:33                                                 ` Jiang Wang .
2021-05-18 13:02                                                   ` Stefano Garzarella
2021-05-19  4:59                                                     ` Jiang Wang .
2021-06-09  4:31                                                       ` Jiang Wang .
2021-06-09  7:40                                                         ` Stefano Garzarella
2021-04-12 22:39   ` [External] " Jiang Wang .
2021-05-13 14:57     ` Stefan Hajnoczi

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=20210413091251-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=arseny.krasnov@kaspersky.com \
    --cc=asias@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=cong.wang@bytedance.com \
    --cc=duanxiongchun@bytedance.com \
    --cc=jiang.wang@bytedance.com \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xieyongji@bytedance.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.