From: "Michael S. Tsirkin" <mst@redhat.com>
To: Arseniy Krasnov <avkrasnov@salutedevices.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Bobby Eshleman <bobby.eshleman@bytedance.com>,
kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@sberdevices.ru, oxffffaa@gmail.com
Subject: Re: [PATCH net-next v8 0/4] send credit update during setting SO_RCVLOWAT
Date: Tue, 12 Dec 2023 10:54:50 -0500 [thread overview]
Message-ID: <20231212105423-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20231211211658.2904268-1-avkrasnov@salutedevices.com>
On Tue, Dec 12, 2023 at 12:16:54AM +0300, Arseniy Krasnov wrote:
> Hello,
>
> DESCRIPTION
>
> This patchset fixes old problem with hungup of both rx/tx sides and adds
> test for it. This happens due to non-default SO_RCVLOWAT value and
> deferred credit update in virtio/vsock. Link to previous old patchset:
> https://lore.kernel.org/netdev/39b2e9fd-601b-189d-39a9-914e5574524c@sberdevices.ru/
Patchset:
Acked-by: Michael S. Tsirkin <mst@redhat.com>
But I worry whether we actually need 3/8 in net not in net-next.
Thanks!
> Here is what happens step by step:
>
> TEST
>
> INITIAL CONDITIONS
>
> 1) Vsock buffer size is 128KB.
> 2) Maximum packet size is also 64KB as defined in header (yes it is
> hardcoded, just to remind about that value).
> 3) SO_RCVLOWAT is default, e.g. 1 byte.
>
>
> STEPS
>
> SENDER RECEIVER
> 1) sends 128KB + 1 byte in a
> single buffer. 128KB will
> be sent, but for 1 byte
> sender will wait for free
> space at peer. Sender goes
> to sleep.
>
>
> 2) reads 64KB, credit update not sent
> 3) sets SO_RCVLOWAT to 64KB + 1
> 4) poll() -> wait forever, there is
> only 64KB available to read.
>
> So in step 4) receiver also goes to sleep, waiting for enough data or
> connection shutdown message from the sender. Idea to fix it is that rx
> kicks tx side to continue transmission (and may be close connection)
> when rx changes number of bytes to be woken up (e.g. SO_RCVLOWAT) and
> this value is bigger than number of available bytes to read.
>
> I've added small test for this, but not sure as it uses hardcoded value
> for maximum packet length, this value is defined in kernel header and
> used to control deferred credit update. And as this is not available to
> userspace, I can't control test parameters correctly (if one day this
> define will be changed - test may become useless).
>
> Head for this patchset is:
> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=021b0c952f226236f2edf89c737efb9a28d1422d
>
> Link to v1:
> https://lore.kernel.org/netdev/20231108072004.1045669-1-avkrasnov@salutedevices.com/
> Link to v2:
> https://lore.kernel.org/netdev/20231119204922.2251912-1-avkrasnov@salutedevices.com/
> Link to v3:
> https://lore.kernel.org/netdev/20231122180510.2297075-1-avkrasnov@salutedevices.com/
> Link to v4:
> https://lore.kernel.org/netdev/20231129212519.2938875-1-avkrasnov@salutedevices.com/
> Link to v5:
> https://lore.kernel.org/netdev/20231130130840.253733-1-avkrasnov@salutedevices.com/
> Link to v6:
> https://lore.kernel.org/netdev/20231205064806.2851305-1-avkrasnov@salutedevices.com/
> Link to v7:
> https://lore.kernel.org/netdev/20231206211849.2707151-1-avkrasnov@salutedevices.com/
>
> Changelog:
> v1 -> v2:
> * Patchset rebased and tested on new HEAD of net-next (see hash above).
> * New patch is added as 0001 - it removes return from SO_RCVLOWAT set
> callback in 'af_vsock.c' when transport callback is set - with that
> we can set 'sk_rcvlowat' only once in 'af_vsock.c' and in future do
> not copy-paste it to every transport. It was discussed in v1.
> * See per-patch changelog after ---.
> v2 -> v3:
> * See changelog after --- in 0003 only (0001 and 0002 still same).
> v3 -> v4:
> * Patchset rebased and tested on new HEAD of net-next (see hash above).
> * See per-patch changelog after ---.
> v4 -> v5:
> * Change patchset tag 'RFC' -> 'net-next'.
> * See per-patch changelog after ---.
> v5 -> v6:
> * New patch 0003 which sends credit update during reading bytes from
> socket.
> * See per-patch changelog after ---.
> v6 -> v7:
> * Patchset rebased and tested on new HEAD of net-next (see hash above).
> * See per-patch changelog after ---.
> v7 -> v8:
> * See per-patch changelog after ---.
>
> Arseniy Krasnov (4):
> vsock: update SO_RCVLOWAT setting callback
> virtio/vsock: send credit update during setting SO_RCVLOWAT
> virtio/vsock: fix logic which reduces credit update messages
> vsock/test: two tests to check credit update logic
>
> drivers/vhost/vsock.c | 1 +
> include/linux/virtio_vsock.h | 1 +
> include/net/af_vsock.h | 2 +-
> net/vmw_vsock/af_vsock.c | 9 +-
> net/vmw_vsock/hyperv_transport.c | 4 +-
> net/vmw_vsock/virtio_transport.c | 1 +
> net/vmw_vsock/virtio_transport_common.c | 43 +++++-
> net/vmw_vsock/vsock_loopback.c | 1 +
> tools/testing/vsock/vsock_test.c | 175 ++++++++++++++++++++++++
> 9 files changed, 229 insertions(+), 8 deletions(-)
>
> --
> 2.25.1
next prev parent reply other threads:[~2023-12-12 15:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 21:16 [PATCH net-next v8 0/4] send credit update during setting SO_RCVLOWAT Arseniy Krasnov
2023-12-11 21:16 ` [PATCH net-next v8 1/4] vsock: update SO_RCVLOWAT setting callback Arseniy Krasnov
2023-12-11 21:16 ` [PATCH net-next v8 2/4] virtio/vsock: send credit update during setting SO_RCVLOWAT Arseniy Krasnov
2023-12-11 21:16 ` [PATCH net-next v8 3/4] virtio/vsock: fix logic which reduces credit update messages Arseniy Krasnov
2023-12-12 8:56 ` Stefano Garzarella
2023-12-12 15:54 ` Michael S. Tsirkin
2023-12-12 15:50 ` Arseniy Krasnov
2023-12-12 16:11 ` Michael S. Tsirkin
2023-12-12 17:41 ` Arseniy Krasnov
2023-12-11 21:16 ` [PATCH net-next v8 4/4] vsock/test: two tests to check credit update logic Arseniy Krasnov
2023-12-12 15:54 ` Michael S. Tsirkin [this message]
2023-12-12 15:59 ` [PATCH net-next v8 0/4] send credit update during setting SO_RCVLOWAT Arseniy Krasnov
2023-12-12 16:12 ` Michael S. Tsirkin
2023-12-12 17:43 ` Arseniy Krasnov
2023-12-13 8:43 ` Stefano Garzarella
2023-12-13 9:08 ` Arseniy Krasnov
2023-12-13 9:41 ` Stefano Garzarella
2023-12-13 10:08 ` Arseniy Krasnov
2023-12-13 15:05 ` Michael S. Tsirkin
2023-12-13 15:13 ` Michael S. Tsirkin
2023-12-13 17:11 ` Arseniy Krasnov
2023-12-13 17:56 ` Michael S. Tsirkin
2023-12-14 8:45 ` Stefano Garzarella
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=20231212105423-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=avkrasnov@salutedevices.com \
--cc=bobby.eshleman@bytedance.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jasowang@redhat.com \
--cc=kernel@sberdevices.ru \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oxffffaa@gmail.com \
--cc=pabeni@redhat.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.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 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).