From patchwork Wed Jan 18 20:27:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 645285 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 A1497C32793 for ; Wed, 18 Jan 2023 20:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229770AbjARUaA (ORCPT ); Wed, 18 Jan 2023 15:30:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230089AbjARU3v (ORCPT ); Wed, 18 Jan 2023 15:29:51 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC0A348A00 for ; Wed, 18 Jan 2023 12:29:23 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id b17so228556pld.7 for ; Wed, 18 Jan 2023 12:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=jKRAitOiQPmbS5rGDLLUsUfTY+3zbVCInzKKQFPomOQ=; b=FF4fNXhpxmUqtDelix2KoSryIBaNqGl+XLfP5SPCekXuBCH9BkdWoDW8nMupEshT62 Ioob3GjJnWXZv1ySlu0Pz9TgviwQ7hMfZKXNfeg3P4MrAOBwL/Q/clkCzckyBi8iItFR sDXf00DQ/kvqnu34xVhg/r6AJkmV70cQk+kPXieWd/8Ssq++E54TJq82Oo5UaJqm+NYC 2liFtD6f9nLxL1x0Bl9ihlQ++UmOhe/cMpoymnNeshPWeuHJ6RnubhF8/ewy3PSTPqUZ qE2AD93U4pPKkPcVbBgMC+IEFwG4OhGVXEU5MnthQ7fjPjqiVPEisHo0zjINbi3s3UaX f7eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jKRAitOiQPmbS5rGDLLUsUfTY+3zbVCInzKKQFPomOQ=; b=xkCaUNDqgLFAR8kCOmzRFT00rdx1V2G2ncfitYAqZyhzsPh8uuxxF/K3HL9PoBAiix Ic0m2NVa3OCJXeDEDjaHSUkeQqOtWhofASLF5/Xfcgz2QcMYx5uNjXAUG5u0K5uxtx1e gYHnNlD4wEcerCR1E6Ogtrce4UxcG+G0zQ4Aet7rLD+hZvoNTZvr8O6nQSfIi3K2kN+O bHEdoWCewCv/oFgeqcdmVuTgIN9CZdcEheBfEHzMW5JLWEO5fBNgL4Ltkpb4GepWsHzY QWjGNgUKKtKuIUPFvvA63OikgnKAZDVrGE+3LCVQ9eDhxaU4xwJpk1bJHBvcqtM89CPd sL6w== X-Gm-Message-State: AFqh2kqnI8Gpq91PGxeoFncH/8ZED46yfrj9lkdmoNBwzZ+wmLWxxS+0 krY3RH/qurH4C+xAGvefyLViBQ== X-Google-Smtp-Source: AMrXdXvEbVDnE8TMf736ZzmYy1jZgkqSSPdF1yfGj5D9moZsDvf8/UHNAFw4GbQucPxSv3nraZPRRg== X-Received: by 2002:a17:90b:1206:b0:229:188a:c0e7 with SMTP id gl6-20020a17090b120600b00229188ac0e7mr8203143pjb.49.1674073763324; Wed, 18 Jan 2023 12:29:23 -0800 (PST) Received: from [127.0.1.1] (c-73-164-155-12.hsd1.wa.comcast.net. [73.164.155.12]) by smtp.gmail.com with ESMTPSA id t13-20020a17090a3b4d00b002132f3e71c6sm1724948pjf.52.2023.01.18.12.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 12:29:22 -0800 (PST) From: Bobby Eshleman Subject: [PATCH RFC 0/3] vsock: add support for sockmap Date: Wed, 18 Jan 2023 12:27:39 -0800 Message-Id: <20230118-support-vsock-sockmap-connectible-v1-0-d47e6294827b@bytedance.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIADtWyGMC/x2OywrCMBBFf6XM2oFOXPjYCn6AW3GRx2iD7SQkM Qil/27i5sLhwuGskDl5znAeVkhcffZBGtBuADtpeTF61xjUqPYj0RHzJ8aQCtYc7Bv7LDqiDSJs izczo2JSp4NTRKSheYzOjCZpsVM3Oa48h7iwlP7GxE///Rfc4Xa9wGPbfgucVMKWAAAA To: Stefan Hajnoczi , Stefano Garzarella , "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrii Nakryiko , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan Cc: 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, Bobby Eshleman , Cong Wang X-Mailer: b4 0.11.2 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 221% 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 (+221%) - The guest redirector was a simple sockmap echo server, redirecting unix ingress to vsock 2:1234 egress. - Same sender and server programs 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. To: Stefan Hajnoczi To: Stefano Garzarella To: "Michael S. Tsirkin" To: Jason Wang To: "David S. Miller" To: Eric Dumazet To: Jakub Kicinski To: Paolo Abeni To: Andrii Nakryiko To: Mykola Lysenko To: Alexei Starovoitov To: Daniel Borkmann To: Martin KaFai Lau To: Song Liu To: Yonghong Song To: John Fastabend To: KP Singh To: Stanislav Fomichev To: Hao Luo To: Jiri Olsa To: Shuah Khan Cc: linux-kernel@vger.kernel.org Cc: kvm@vger.kernel.org Cc: virtualization@lists.linux-foundation.org Cc: netdev@vger.kernel.org Cc: bpf@vger.kernel.org Cc: linux-kselftest@vger.kernel.org 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 | 59 ++++++- net/vmw_vsock/virtio_transport.c | 2 + net/vmw_vsock/virtio_transport_common.c | 22 +++ net/vmw_vsock/vsock_bpf.c | 180 +++++++++++++++++++++ net/vmw_vsock/vsock_loopback.c | 2 + tools/testing/selftests/bpf/config.x86_64 | 4 + .../selftests/bpf/prog_tests/sockmap_listen.c | 163 +++++++++++++++++++ tools/testing/selftests/bpf/vmtest.sh | 1 + 12 files changed, 447 insertions(+), 6 deletions(-) --- base-commit: f12f4326c6a75a74e908714be6d2f0e2f0fd0d76 change-id: 20230118-support-vsock-sockmap-connectible-2e1297d2111a Best regards,