From patchwork Sat Dec 21 00:42:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mina Almasry X-Patchwork-Id: 13917556 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C660163 for ; Sat, 21 Dec 2024 00:51:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734742296; cv=none; b=dHgJ8kqTjUx4Qq9lNRNTOsVw85ODNDXKpt7peA5O+cxCasGAc12wcqTCQ6AUNKwMrDaS7ORtoooKfXrsv02In8qBTKAgWM6Ki2/Zqa21Ryz38SjQSwA3T0hp3BpNuUDaLaB5s1YJi2GRlMh6qmOxhRPrOHzBxwXDLpFVqbJ0hYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734742296; c=relaxed/simple; bh=FRENkPdw5MsSuos6hv3KfxF0ISP2Qe0RZAlvdgY5Q+0=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=SFWSBcTJUGD5sTElRydcooh1MLXDdf2BmnvKIXTLkdo0bj4dVQcB58oe633VzMCcdQPgvmd8vVaLqNNovcbW2ODamQIu0yyjMHqj9yP064TgBH5Ko2HsV8HKYA4LIkm+Lnf6jEG+qDwiCPa5O8CesBF6876PxhYdRipYn3Ji+QE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--almasrymina.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=I7uJk11h; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--almasrymina.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="I7uJk11h" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-7289afa200aso2982279b3a.0 for ; Fri, 20 Dec 2024 16:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1734742294; x=1735347094; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=yJnN7ZrxN0wnWRniinuaZCCRmMgcnMSCXct+QU5IKEI=; b=I7uJk11hWHysVG2cJjFu7N6jWbQ5FeiKh+AbvSgWnPEX1814KzGy4eFTyB6Y8X8lJD gLMjT1G6Qi33skl92zvmuVC3jaguwy1c/jYV6nPfbAYqIjaEYJHNjr8p5j64jv022xV8 QoSitZAr4dQ86RJMyqjJe1nrn0010KuCF36JrWWsXNvQJFkGydPwZgSS126nyo7MzV5e 9kv0qO5KMijtB0cbccMjrXU808cjgs+FIgk+mDyJGVcgb+qsljSRQUi2by0edDU+tQKx DCVeDVi8wfJbWydcgC6KhTHov2QELx3U24ZADAoj9m1rKeExKkNGdbaTEXSKGygapa7V xnWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734742294; x=1735347094; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=yJnN7ZrxN0wnWRniinuaZCCRmMgcnMSCXct+QU5IKEI=; b=hLXqxKyj5upCJHSN91zEabeictUs3xsXs7ZisHsRuLMdtZ5IdRjDx6Mc/caQZCiw6R coOqcy/RryibifW3tnEghFWsVfkKCxysN2Dk/+RV336SsoTw/Bnw3CRdPv8x7qidWpXc jSd3hMLidUMsfTPsKkPPIpfZxvVlIRLNKY1pjrcT0mc4n7t/nUY0HCKCIRdQMtWxbuub xVcdeCYXYFKbaH5Ee5kBv3hxh0hVQLpYwhOL4c+R9QOeBWt75T9dfadhT1rSewidUDIB CfhscSbQvd98fBEBxQh9fEjPBM4k0x/3pfhrhJbSVN1tsVqmQ0i4MABUVNLHhuQpHz6X zkOg== X-Gm-Message-State: AOJu0Yy8Mk+4N/pt8AhWU1l1biRAShcgPoKA1DyT1eeKwbEiSbqlMiMi I0GvusqJUCwTQHMb7R+sZU7SkrJS9eq0t0iZkH/GmwtSM9sjtGotaFn5NpLjE/CS0y//fqNvJZg 3DNUrQyC4+lt+FCf0y8ZEhKpHyPTNhjkq2cEg7GD1tq0eQ8m7LgdTAe2ugJna448vFxNYNDrlRw FTWlqkruY9B9EggL+hns4DybtO2baqXIIQbaoJR6b5KIdqE+k/Sa3Lznmy0Ds= X-Google-Smtp-Source: AGHT+IFPPx0YiYiLnd8xNfIIbmIMwDB+OM3W+mCwV2V7dSBNzPOeeDA2h35zKUR6WA/aeA9SZXl5yVBt8+4OkZfrCg== X-Received: from pfms15.prod.google.com ([2002:aa7:828f:0:b0:72a:bcc3:4c9a]) (user=almasrymina job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1311:b0:728:e81c:2bf4 with SMTP id d2e1a72fcca58-72abddb1958mr6921748b3a.11.1734742294312; Fri, 20 Dec 2024 16:51:34 -0800 (PST) Date: Sat, 21 Dec 2024 00:42:31 +0000 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Message-ID: <20241221004236.2629280-1-almasrymina@google.com> Subject: [PATCH RFC net-next v1 0/5] Device memory TCP TX From: Mina Almasry To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Mina Almasry , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter , Jonathan Corbet , Andrew Lunn , David Ahern , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , " =?utf-8?q?Eugenio_P=C3=A9rez?= " , Stefan Hajnoczi , Stefano Garzarella , Shuah Khan , Kaiyuan Zhang , Pavel Begunkov , Willem de Bruijn , Samiullah Khawaja , Stanislav Fomichev , Joe Damato , dw@davidwei.uk X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The TX path had been dropped from the Device Memory TCP patch series post RFCv1 [1], to make that series slightly easier to review. This series rebases the implementation of the TX path on top of the net_iov/netmem framework agreed upon and merged. The motivation for the feature is thoroughly described in the docs & cover letter of the original proposal, so I don't repeat the lengthy descriptions here, but they are available in [1]. Sending this series as RFC as the winder closure is immenient. I plan on reposting as non-RFC once the tree re-opens, addressing any feedback I receive in the meantime. Full outline on usage of the TX path is detailed in the documentation added in the first patch. Test example is available via the kselftest included in the series as well. The series is relatively small, as the TX path for this feature largely piggybacks on the existing MSG_ZEROCOPY implementation. Patch Overview: --------------- 1. Documentation & tests to give high level overview of the feature being added. 2. Add netmem refcounting needed for the TX path. 3. Devmem TX netlink API. 4. Devmem TX net stack implementation. Testing: -------- Testing is very similar to devmem TCP RX path. The ncdevmem test used for the RX path is now augemented with client functionality to test TX path. * Test Setup: Kernel: net-next with this RFC and memory provider API cherry-picked locally. Hardware: Google Cloud A3 VMs. NIC: GVE with header split & RSS & flow steering support. Performance results are not included with this version, unfortunately. I'm having issues running the dma-buf exporter driver against the upstream kernel on my test setup. The issues are specific to that dma-buf exporter and do not affect this patch series. I plan to follow up this series with perf fixes if the tests point to issues once they're up and running. Special thanks to Stan who took a stab at rebasing the TX implementation on top of the netmem/net_iov framework merged. Parts of his proposal [2] that are reused as-is are forked off into their own patches to give full credit. [1] https://lore.kernel.org/netdev/20240909054318.1809580-1-almasrymina@google.com/ [2] https://lore.kernel.org/netdev/20240913150913.1280238-2-sdf@fomichev.me/T/#m066dd407fbed108828e2c40ae50e3f4376ef57fd Cc: sdf@fomichev.me Cc: asml.silence@gmail.com Cc: dw@davidwei.uk Mina Almasry (4): net: add devmem TCP TX documentation selftests: ncdevmem: Implement devmem TCP TX net: add get_netmem/put_netmem support net: devmem: Implement TX path Stanislav Fomichev (1): net: devmem TCP tx netlink api Documentation/netlink/specs/netdev.yaml | 12 + Documentation/networking/devmem.rst | 140 +++++++++- include/linux/skbuff.h | 13 +- include/linux/skbuff_ref.h | 4 +- include/net/netmem.h | 3 + include/net/sock.h | 2 + include/uapi/linux/netdev.h | 1 + include/uapi/linux/uio.h | 5 + net/core/datagram.c | 40 ++- net/core/devmem.c | 101 ++++++- net/core/devmem.h | 51 +++- net/core/netdev-genl-gen.c | 13 + net/core/netdev-genl-gen.h | 1 + net/core/netdev-genl.c | 67 ++++- net/core/skbuff.c | 38 ++- net/core/sock.c | 9 + net/ipv4/tcp.c | 36 ++- net/vmw_vsock/virtio_transport_common.c | 4 +- tools/include/uapi/linux/netdev.h | 1 + .../selftests/drivers/net/hw/ncdevmem.c | 261 +++++++++++++++++- 20 files changed, 764 insertions(+), 38 deletions(-)