Message ID | 20230327-vsock-sockmap-v4-0-c62b7cd92a85@bytedance.com (mailing list archive) |
---|---|
Headers | show |
Series | Add support for sockmap to vsock. | expand |
Hello: This series was applied to netdev/net-next.git (main) by David S. Miller <davem@davemloft.net>: On Mon, 27 Mar 2023 19:11:50 +0000 you wrote: > 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. > > [...] Here is the summary with links: - [net-next,v4,1/3] vsock: support sockmap https://git.kernel.org/netdev/net-next/c/634f1a7110b4 - [net-next,v4,2/3] selftests/bpf: add vsock to vmtest.sh https://git.kernel.org/netdev/net-next/c/c7c605c982d6 - [net-next,v4,3/3] selftests/bpf: add a test case for vsock sockmap https://git.kernel.org/netdev/net-next/c/d61bd8c1fd02 You are awesome, thank you!
Bobby Eshleman wrote: > 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. Appears reasonable to me although I didn't review internals of all the af_vsock stuff. I see it got merged great. One nit, I have a series coming shortly to pull the tests out of the sockmap_listen and into a sockmap_vsock because I don't think they belong in _listen but that is just a refactor.
On Fri, Mar 31, 2023 at 06:06:10PM -0700, John Fastabend wrote: >Bobby Eshleman wrote: >> 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. > >Appears reasonable to me although I didn't review internals of all >the af_vsock stuff. I see it got merged great. Thanks for checking! > >One nit, I have a series coming shortly to pull the tests out of >the sockmap_listen and into a sockmap_vsock because I don't think they >belong in _listen but that is just a refactor. > LGTM! Thanks, Stefano
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 v4: - af_vsock: fix parameter alignment in vsock_dgram_recvmsg() - af_vsock: add TCP_ESTABLISHED comment in vsock_dgram_connect() - vsock/bpf: change ret type to bool Changes in v3: - vsock/bpf: Refactor wait logic in vsock_bpf_recvmsg() to avoid backwards goto - vsock/bpf: Check psock before acquiring slock - vsock/bpf: Return bool instead of int of 0 or 1 - vsock/bpf: Wrap macro args __sk/__psock in parens - vsock/bpf: Place comment trailer */ on separate line 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 | 64 +++++++- net/vmw_vsock/virtio_transport.c | 2 + net/vmw_vsock/virtio_transport_common.c | 25 +++ net/vmw_vsock/vsock_bpf.c | 174 +++++++++++++++++++++ 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, 452 insertions(+), 6 deletions(-) --- base-commit: e5b42483ccce50d5b957f474fd332afd4ef0c27b change-id: 20230327-vsock-sockmap-30b090c70cd1 Best regards,