From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: virtio-comment@lists.oasis-open.org, jasowang@redhat.com,
cohuck@redhat.com, stefanha@redhat.com,
arseny.krasnov@kaspersky.com
Subject: Re: [PATCH v12 0/3] virtio-vsock: SOCK_SEQPACKET description
Date: Fri, 14 Jan 2022 12:58:45 -0500 [thread overview]
Message-ID: <20220114112936-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20220113165202.250429-1-sgarzare@redhat.com>
On Thu, Jan 13, 2022 at 05:51:59PM +0100, Stefano Garzarella wrote:
> v12:
> - added statement about supporting F_STREAM when F_SEQPACKET is negotiated
> [cohuck, mst]
>
> v11: https://lists.oasis-open.org/archives/virtio-comment/202201/msg00027.html
> - reworked "Message and record boundaries" paragraph [stefanha]
>
> Linux kernel and QEMU already merged SOCK_SEQPACKET support,
> so I'm resending Arseny's patches to have consistent virtio-spec
> and implementation.
>
> I added patch 2, following the discussion about F_STREAM feature bit:
> https://markmail.org/message/aoaspjy2jhidwbuo#query:+page:1+mid:obw54zzikgqimhjk+state:results
>
> Thanks,
> Stefano
Was going to vote on this and was reviewing for the last time, when I
detected a problem with SEQPACKET.
Specifically, with STREAM for flow control management purposes we only
count payload bytes since it is always possible to copy all data into a
single buffer.
Not so with SEQPACKET where in the worst case it is possible to have
single byte messages, each consuming multiple bytes of meta-data to
track message boundaries. This does work with the current proposal
simply by publishing a smaller buffer to the other side, e.g. with a 64
byte header we'd publish a 1K buffer and in practice it will occupy up
to 65K. Tolerable, and there's nothing new here. OK.
However, just today I noticed this in the unix man page for SEQPACKET:
SOCK_SEQPACKET
Provides a sequenced, reliable, two-way connection-based
data transmission path for datagrams of fixed maximum
length;
The point here being that it needs to be limited so userspace knows how
large is a message it can send - since dropping messages is not allowed
this has to happen upfront.
And I noticed that our text does not mention the maximum length.
So I asked myself what is the maximum length for vsock.
After some poking around I realized that the largest message we can
accept has to be capped to buf_alloc. However this makes the buffer size
visible to userspace and so conflicts with the idea of limiting
it for memory management purposes as described above.
So it looks like we need to add a seqpacket message header overhead
field in the config space, and if present take that into account.
I am not sure what to do about it at this point.
Together with guests assuming this implies stream this looks a bit much.
Sorry that I just noticed this part now, I guess better late than never.
Given it's deployed anyway, I guess we can put it in the spec as is,
however in that case I guess we should just document what's there,
maybe add some text explaining that it will be superceded
in a future version. But that *also* will mean we should
make it imply STREAM support since that is what happens in
the field. Maybe rename this to VIRTIO_VSOCK_F_SEQPACKET_COMPAT
or something like this.
Thoughts?
> Arseny Krasnov (2):
> virtio-vsock: use C style defines for constants
> virtio-vsock: SOCK_SEQPACKET description
>
> Stefano Garzarella (1):
> virtio-vsock: add VIRTIO_VSOCK_F_STREAM feature bit
>
> virtio-vsock.tex | 88 +++++++++++++++++++++++++++++++++---------------
> 1 file changed, 60 insertions(+), 28 deletions(-)
>
> --
> 2.31.1
next prev parent reply other threads:[~2022-01-14 17:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-13 16:51 [PATCH v12 0/3] virtio-vsock: SOCK_SEQPACKET description Stefano Garzarella
2022-01-13 16:52 ` [PATCH v12 1/3] virtio-vsock: use C style defines for constants Stefano Garzarella
2022-01-13 16:52 ` [virtio-comment] [PATCH v12 2/3] virtio-vsock: add VIRTIO_VSOCK_F_STREAM feature bit Stefano Garzarella
2022-01-13 16:52 ` [PATCH v12 3/3] virtio-vsock: SOCK_SEQPACKET description Stefano Garzarella
2022-01-14 9:39 ` [PATCH v12 0/3] " Stefano Garzarella
2022-01-14 10:08 ` [virtio-comment] " Cornelia Huck
2022-01-14 17:58 ` Michael S. Tsirkin [this message]
2022-01-17 9:33 ` Stefano Garzarella
2022-01-17 9:46 ` [virtio-comment] " Arseny Krasnov
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=20220114112936-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=arseny.krasnov@kaspersky.com \
--cc=cohuck@redhat.com \
--cc=jasowang@redhat.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtio-comment@lists.oasis-open.org \
/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.