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: 4198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2547512wrn; Wed, 18 Jan 2023 12:30:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXuZQ3hTJ4i13pIM7QFcK//5RNU34Vyvs8V8JmUJ5ksFRFQXGcMakDzsWN7ExAmEsWToxj/9 X-Received: by 2002:a17:902:a614:b0:188:d434:9c67 with SMTP id u20-20020a170902a61400b00188d4349c67mr8441194plq.32.1674073825842; Wed, 18 Jan 2023 12:30:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674073825; cv=none; d=google.com; s=arc-20160816; b=b0izat9T0IGYWhDCTNpjoIfJv1XWafMa59CHnX3zC8a8HuSqZzsebFK1mTH7eMoiqx FNg1fFY0ii4w9KeUQO7YDlJlxVfonM3VnsM6ErjTlL1A5OyoDXqEsfu0uN1yCul5UyjL CYyDEfmRzjPzM8QYBnnqseoEz7/dpf/8YBbQP3Dx9ssij1B+jHxViH29rrD9BywZ6oO3 VCzRstAmd0NC6PWVMZfbGcUAlPlYxZMK0lR6AYE1wAPS13XRCrPvISIQLJRQew6ogq+k F3RqAI48iRzeWeA+5mEbuFWaFqBbKsxQXU+inG9/2N3LLN8eNLecluXRarpuP6mthjhO nduQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=jKRAitOiQPmbS5rGDLLUsUfTY+3zbVCInzKKQFPomOQ=; b=o5KlG4Z4MdzgUhRZ9TYc6pqi45VSdfxczE0PujkVJ6iJo6zvMEKFYdAe1TReQ04/xn VWX/qXHrR3gdPoR3MJtqKvtWw0EkIKZhbsP/5ddII8xa8OFWXAhihhvuJtv8G4WU0HqH qjalT/iVxq+ClXnKzTCraDdO7reKKyIkBpND1CbL5b5K7hOrdy6QhRhDpqsGbfdm/fH4 3auN3xlM5OSVggzi9JRM/lsjlRHzF7h0UMMHNCGmg8JxBsgx7ILcyUbeuUjLszUAfCJA p8pJ/UBBP8pS5A3u8aUjhvVyGt8XK/EMLOLxZnK1kLa80WKoLnQObRswp9WK1gOFhsli iWuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=FF4fNXhp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a170902724500b001910b27870esi34552068pll.512.2023.01.18.12.30.08; Wed, 18 Jan 2023 12:30:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=FF4fNXhp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbjARU31 (ORCPT + 99 others); Wed, 18 Jan 2023 15:29:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbjARU3Z (ORCPT ); Wed, 18 Jan 2023 15:29:25 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD968539BA for ; Wed, 18 Jan 2023 12:29:23 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id d3so213075plr.10 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=7oe20+juAcbdz+55u3W8G6iB+4D25Lgqx+hgEpYN7kdf6/YIWO3zeWPVPg+Y3p16ft e2a+lFguTC8bhhB/6cAq6orTmmL991oGOvV7YyY+gXYry2/lFXLttqkDN6SC7MOJBkvl BjzoFrQIhKryhenMsWF9M4YhMQD3vddPr7s3YoVvDOSrgnk1DyeFo59kxRmLF0gkDXA6 QWYAHv3pmlHsxWeBwvH/6PmOVHgy/9yK0KPkYAZxL15tr64zrkRXOxNrKAoRxy9SqAna CLTV8KYYOVD8DN4Urn2AmhY28u7Bp8sBS7IsWck4h6WW7Z7N5ZpsSWkD4pHWaILDovNr 6ekQ== X-Gm-Message-State: AFqh2kr5jilcO0wGX94p3JBp0IuUEL/7BvXpYoQ/zRemD+jIuNdOc5yf 2q8UUBilmqsliycG/uvYjUs5EQ== 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755393636052753596?= X-GMAIL-MSGID: =?utf-8?q?1755393636052753596?= 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,