Message ID | 20230118-support-vsock-sockmap-connectible-v2-0-58ffafde0965@bytedance.com (mailing list archive) |
---|---|
Headers | show |
Series | vsock: add support for sockmap | expand |
On Sun, Feb 05, 2023 at 12:08:49PM -0800, Cong Wang wrote: > On Mon, Jan 30, 2023 at 08:35:11PM -0800, Bobby Eshleman wrote: > > Add support for sockmap to vsock. > > > > We're testing usage of vsock as a way to redirect guest-local UDS requests to > > the host and this patch series greatly improves the performance of such a > > setup. > > > > Compared to copying packets via userspace, this improves throughput by 121% in > > basic testing. > > > > Tested as follows. > > > > Setup: guest unix dgram sender -> guest vsock redirector -> host vsock server > > Threads: 1 > > Payload: 64k > > No sockmap: > > - 76.3 MB/s > > - The guest vsock redirector was > > "socat VSOCK-CONNECT:2:1234 UNIX-RECV:/path/to/sock" > > Using sockmap (this patch): > > - 168.8 MB/s (+121%) > > - The guest redirector was a simple sockmap echo server, > > redirecting unix ingress to vsock 2:1234 egress. > > - Same sender and server programs > > > > *Note: these numbers are from RFC v1 > > > > Only the virtio transport has been tested. The loopback transport was used in > > writing bpf/selftests, but not thoroughly tested otherwise. > > > > This series requires the skb patch. > > > > Looks good to me. Definitely good to go as non-RFC. > > Thanks. Thank you for the review. Best, Bobby
On Mon, Jan 30, 2023 at 08:35:11PM -0800, Bobby Eshleman wrote: > Add support for sockmap to vsock. > > We're testing usage of vsock as a way to redirect guest-local UDS requests to > the host and this patch series greatly improves the performance of such a > setup. > > Compared to copying packets via userspace, this improves throughput by 121% in > basic testing. > > Tested as follows. > > Setup: guest unix dgram sender -> guest vsock redirector -> host vsock server > Threads: 1 > Payload: 64k > No sockmap: > - 76.3 MB/s > - The guest vsock redirector was > "socat VSOCK-CONNECT:2:1234 UNIX-RECV:/path/to/sock" > Using sockmap (this patch): > - 168.8 MB/s (+121%) > - The guest redirector was a simple sockmap echo server, > redirecting unix ingress to vsock 2:1234 egress. > - Same sender and server programs > > *Note: these numbers are from RFC v1 > > Only the virtio transport has been tested. The loopback transport was used in > writing bpf/selftests, but not thoroughly tested otherwise. > > This series requires the skb patch. > Looks good to me. Definitely good to go as non-RFC. Thanks.
Hi Bobby, sorry for my late reply, but I have been offline these days. I came back a few days ago and had to work off some accumulated work :-) On Mon, Jan 30, 2023 at 08:35:11PM -0800, Bobby Eshleman wrote: >Add support for sockmap to vsock. > >We're testing usage of vsock as a way to redirect guest-local UDS requests to >the host and this patch series greatly improves the performance of such a >setup. > >Compared to copying packets via userspace, this improves throughput by 121% in >basic testing. > >Tested as follows. > >Setup: guest unix dgram sender -> guest vsock redirector -> host vsock server >Threads: 1 >Payload: 64k >No sockmap: >- 76.3 MB/s >- The guest vsock redirector was > "socat VSOCK-CONNECT:2:1234 UNIX-RECV:/path/to/sock" >Using sockmap (this patch): >- 168.8 MB/s (+121%) >- The guest redirector was a simple sockmap echo server, > redirecting unix ingress to vsock 2:1234 egress. >- Same sender and server programs > >*Note: these numbers are from RFC v1 > >Only the virtio transport has been tested. The loopback transport was used in >writing bpf/selftests, but not thoroughly tested otherwise. > >This series requires the skb patch. > >Changes in v2: >- vsock/bpf: rename vsock_dgram_* -> vsock_* >- vsock/bpf: change sk_psock_{get,put} and {lock,release}_sock() order to > minimize slock hold time >- vsock/bpf: use "new style" wait >- vsock/bpf: fix bug in wait log >- vsock/bpf: add check that recvmsg sk_type is one dgram, seqpacket, or stream. > Return error if not one of the three. >- virtio/vsock: comment __skb_recv_datagram() usage >- virtio/vsock: do not init copied in read_skb() >- vsock/bpf: add ifdef guard around struct proto in dgram_recvmsg() >- selftests/bpf: add vsock loopback config for aarch64 >- selftests/bpf: add vsock loopback config for s390x >- selftests/bpf: remove vsock device from vmtest.sh qemu machine >- selftests/bpf: remove CONFIG_VIRTIO_VSOCKETS=y from config.x86_64 >- vsock/bpf: move transport-related (e.g., if (!vsk->transport)) checks out of > fast path The series looks in a good shape. I left some small comments on the first patch, but I think the next version could be without RFC, so we can receive some feedbacks from net/bpf maintainers. Great job! Thanks, Stefano
Add support for sockmap to vsock. We're testing usage of vsock as a way to redirect guest-local UDS requests to the host and this patch series greatly improves the performance of such a setup. Compared to copying packets via userspace, this improves throughput by 121% in basic testing. Tested as follows. Setup: guest unix dgram sender -> guest vsock redirector -> host vsock server Threads: 1 Payload: 64k No sockmap: - 76.3 MB/s - The guest vsock redirector was "socat VSOCK-CONNECT:2:1234 UNIX-RECV:/path/to/sock" Using sockmap (this patch): - 168.8 MB/s (+121%) - The guest redirector was a simple sockmap echo server, redirecting unix ingress to vsock 2:1234 egress. - Same sender and server programs *Note: these numbers are from RFC v1 Only the virtio transport has been tested. The loopback transport was used in writing bpf/selftests, but not thoroughly tested otherwise. This series requires the skb patch. Changes in v2: - vsock/bpf: rename vsock_dgram_* -> vsock_* - vsock/bpf: change sk_psock_{get,put} and {lock,release}_sock() order to minimize slock hold time - vsock/bpf: use "new style" wait - vsock/bpf: fix bug in wait log - vsock/bpf: add check that recvmsg sk_type is one dgram, seqpacket, or stream. Return error if not one of the three. - virtio/vsock: comment __skb_recv_datagram() usage - virtio/vsock: do not init copied in read_skb() - vsock/bpf: add ifdef guard around struct proto in dgram_recvmsg() - selftests/bpf: add vsock loopback config for aarch64 - selftests/bpf: add vsock loopback config for s390x - selftests/bpf: remove vsock device from vmtest.sh qemu machine - selftests/bpf: remove CONFIG_VIRTIO_VSOCKETS=y from config.x86_64 - vsock/bpf: move transport-related (e.g., if (!vsk->transport)) checks out of fast path Signed-off-by: Bobby Eshleman <bobby.eshleman@bytedance.com> --- Bobby Eshleman (3): vsock: support sockmap selftests/bpf: add vsock to vmtest.sh selftests/bpf: Add a test case for vsock sockmap drivers/vhost/vsock.c | 1 + include/linux/virtio_vsock.h | 1 + include/net/af_vsock.h | 17 ++ net/vmw_vsock/Makefile | 1 + net/vmw_vsock/af_vsock.c | 55 ++++++- net/vmw_vsock/virtio_transport.c | 2 + net/vmw_vsock/virtio_transport_common.c | 24 +++ net/vmw_vsock/vsock_bpf.c | 175 +++++++++++++++++++++ net/vmw_vsock/vsock_loopback.c | 2 + tools/testing/selftests/bpf/config.aarch64 | 2 + tools/testing/selftests/bpf/config.s390x | 3 + tools/testing/selftests/bpf/config.x86_64 | 3 + .../selftests/bpf/prog_tests/sockmap_listen.c | 163 +++++++++++++++++++ 13 files changed, 443 insertions(+), 6 deletions(-) --- base-commit: d83115ce337a632f996e44c9f9e18cadfcf5a094 change-id: 20230118-support-vsock-sockmap-connectible-2e1297d2111a Best regards,