Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DBCFC6FD19 for ; Fri, 10 Mar 2023 09:01:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231322AbjCJJBV (ORCPT ); Fri, 10 Mar 2023 04:01:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231240AbjCJJAt (ORCPT ); Fri, 10 Mar 2023 04:00:49 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAFCCF2484 for ; Fri, 10 Mar 2023 00:53:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678438427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nyujGqY6hbL21R7JvgsLqfIPq6KmX0JyLo05ppN+aX0=; b=SKVQuvQ8NgsqHx47PJ5botKhooWmTguShV+6YJPFAjEf9NjuLAu4Pq3D7oc21oWKme/Qeq TXlBCLgJFYMm3l2mdLz/oUfg4BzUHx5iObAn6WVYqWKOLh1mpT641s0+VQ2Fcmo+Je8EPQ wRjLGv0W9dzIrxPNFU2fWfFr8EE3fHA= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-210-VvIkpD3mOaaORk-wLNv30w-1; Fri, 10 Mar 2023 03:53:45 -0500 X-MC-Unique: VvIkpD3mOaaORk-wLNv30w-1 Received: by mail-wm1-f72.google.com with SMTP id e22-20020a05600c219600b003e000facbb1so3558654wme.9 for ; Fri, 10 Mar 2023 00:53:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678438425; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nyujGqY6hbL21R7JvgsLqfIPq6KmX0JyLo05ppN+aX0=; b=xm+/wdQ45KJIPU+yTahxpPBm9EZ9Dfe+ZodqflsYeh6qwv/auLGWIkAnakJItJXYtl TTgP9FEw67iqzfhp5+TI/HbXO6y0LYJWhn+0veRLeVRcBejkuJ+4UauzjF3/ZZkGWwIQ m/m22FZ2D9MVFFclxkdbIE4TUilwXhE8/Cf9hzfZ7vdeBOMbo56vkFQ/1CXSGH/+jZtL fhoibYF7SuI8sGZyJKtN5MfzTneABf1gaYvtEcQIXZTcr2EuADkT80JKqv0vXrCcBpWu b7nGcjNuMWWcKyUuisB8SrEbVriR57KgVp2/PfI4LhpPhD8gW5arK5Fl8h/X20lsTW89 VIjQ== X-Gm-Message-State: AO0yUKW+J03CE1EklUmFvTaGxS8idxVg77ldmGNukzXv2ivOE68/Ouyu pRcV5U2BnuoQwKL3188Lur/csLHsToUyE66rHBrvGg+KKw8W7LtU7v9B1aGyhc5Vyc130dFwKds fglToxq6Zjf4ORQQpq6jMXCUm X-Received: by 2002:a05:600c:1c17:b0:3dc:557f:6123 with SMTP id j23-20020a05600c1c1700b003dc557f6123mr1946411wms.1.1678438424835; Fri, 10 Mar 2023 00:53:44 -0800 (PST) X-Google-Smtp-Source: AK7set82MkObAZdWQPCWwT+eXdPJoKLSsejspunYV9KZmp0T6Zmmx7jMIADOEHFaY00hmbmSF3ENFw== X-Received: by 2002:a05:600c:1c17:b0:3dc:557f:6123 with SMTP id j23-20020a05600c1c1700b003dc557f6123mr1946371wms.1.1678438424470; Fri, 10 Mar 2023 00:53:44 -0800 (PST) Received: from redhat.com ([2.52.9.88]) by smtp.gmail.com with ESMTPSA id y6-20020a5d6146000000b002c54fb024b2sm1553272wrt.61.2023.03.10.00.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 00:53:43 -0800 (PST) Date: Fri, 10 Mar 2023 03:53:37 -0500 From: "Michael S. Tsirkin" To: Bobby Eshleman Cc: Stefan Hajnoczi , Stefano Garzarella , Jason Wang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, Cong Wang Subject: Re: [PATCH net-next v3 0/3] vsock: add support for sockmap Message-ID: <20230310035307-mutt-send-email-mst@kernel.org> References: <20230227-vsock-sockmap-upstream-v3-0-7e7f4ce623ee@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230227-vsock-sockmap-upstream-v3-0-7e7f4ce623ee@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 28, 2023 at 07:04:33PM +0000, 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. besides the small comment, looks ok. Feel free to include my ack in v4: Acked-by: Michael S. Tsirkin > 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 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 (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, > -- > Bobby Eshleman > > --- > 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 | 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, 443 insertions(+), 6 deletions(-) > --- > base-commit: c2ea552065e43d05bce240f53c3185fd3a066204 > change-id: 20230227-vsock-sockmap-upstream-9d65c84174a2 > > Best regards, > -- > Bobby Eshleman