Skip to content

send credit update during setting SO_RCVLOWAT

Arseniy Krasnov kvm lkml netdev virtualization 10 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest3 patches 0 repliesApplied 3/3
  2. v94 patches 7 repliesSuperseded
  3. v84 patches 18 repliesSuperseded
Earlier versions · 7
VersionPostedPatchesRepliesStatus
v74 patches7 repliesSuperseded
v64 patches5 repliesSuperseded
v53 patches18 repliesSuperseded
v4 RFC3 patches4 repliesSuperseded
v3 RFC3 patches4 repliesSuperseded
v2 RFC3 patches0 repliesSuperseded
v1 RFC2 patches7 repliesSuperseded

Changes in v10 from the cover letter

* Squash 0002 and 0003 and update commit message in result.

Patches in v10 All 3 applied

#Subject and filesSizeRepliesApplied
1/3virtio/vsock: fix logic which reduces credit update messagesnet/vmw_vsock/virtio_transport_common.c+10 -30 repliesApplied
2/3virtio/vsock: send credit update during setting SO_RCVLOWATdrivers/vhost/vsock.c include/linux/virtio_vsock.h include/net/af_vsock.h +5 more+44 -50 repliesApplied
3/3vsock/test: two tests to check credit update logictools/testing/vsock/vsock_test.c+175 -00 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchStefano GarzarellaMichael S. Tsirkin
1/3R-b A-b
2/3R-b A-b
3/3R-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v10 thread

Cover letter [PATCH net-next v10 0/3] send credit update during setting SO_RCVLOWAT

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/[email protected]/

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=9bab51bd662be4c3ebb18a28879981d69f3ef15a

Link to v1:
https://lore.kernel.org/netdev/[email protected]/
Link to v2:
https://lore.kernel.org/netdev/[email protected]/
Link to v3:
https://lore.kernel.org/netdev/[email protected]/
Link to v4:
https://lore.kernel.org/netdev/[email protected]/
Link to v5:
https://lore.kernel.org/netdev/[email protected]/
Link to v6:
https://lore.kernel.org/netdev/[email protected]/
Link to v7:
https://lore.kernel.org/netdev/[email protected]/
Link to v8:
https://lore.kernel.org/netdev/[email protected]/
Link to v9:
https://lore.kernel.org/netdev/[email protected]/

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 ---.
v8 -> v9:
* Patchset rebased and tested on new HEAD of net-next (see hash above).
* Add 'Fixes' tag for the current 0002.
* Reorder patches by moving two fixes first.
v9 -> v10:
* Squash 0002 and 0003 and update commit message in result.

Arseniy Krasnov (3):
virtio/vsock: fix logic which reduces credit update messages virtio/vsock: send credit update during setting SO_RCVLOWAT 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(-)
Signature · 1 line
2.25.1