From patchwork Thu Sep 17 15:29:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 45 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6446:b0:8a0:ea1f:253a with SMTP id n6csp7554779mag; Thu, 17 Sep 2026 08:30:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwDpUJWd8Ndp1YPfbPgi+LCUakFHHo7GgvUkTrq10YUCqFqv9eqBE6NDpsocifg/5+SSlRsU/gyKIY=@openvpn.net X-Received: by 2002:a05:6870:d10f:b0:448:71f4:a28 with SMTP id 586e51a60fabf-484750ee66emr11050931fac.2.1789659032812; Thu, 17 Sep 2026 08:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1789659032; cv=none; d=google.com; s=arc-20260327; b=PN32ei+1/skWYOzKrH/27KcjUszGEbGzRsQoGNsaDXNaCWgeZrXegf/J+/WlulQ6b9 2wwdh2QxoGryfUPBzhBd8C9QyHgBTxJi8e5v6maP1aFCIBY20D2FIGwWybxPepVQRR0y ExFcPFgXW5lXaTJ76Cu8UARYWbL3SXreqZPhDAyX975ZqK0rsuh8+ImL8i7KXvplJIwP bzwgPayZ9chbxzyUxeNFhtZiXdVhyESoXCs8QcO4lXZCUXRXsmumyQcwobM7UwvfvSGK L2zuh3upwSomAsBtBbYgOgnQt+xPlL3dS/ZwkJFJxq8aDnYRYOFss1VBOCYbXkXSp5Nh OkOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=RjbOgVN2jD0hO2qppD1xYaq857xqUVarzlljS0AMLjc=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=lZuXDEoG2BMlfP9yU+t1sIQdYps8SXKvQqDqqYmfroR4OvqU9siseK1c8iSOg9147U RtGld3pjA/clM+TnrI8n8Im7J+891eDvuOAMHCGcP3e1aUJgpmMwzNI6vi5nZdRF/2Gs 3bGZOpzQgASwAV2Ha9PHGA1fpVxbRxXh2bd4yXoGTQ5wQ19vCb7qEpiHvDnm+qKxmtVJ z1T/H7kHifMTmInAjIb39A8X0Q8pvpdb0ch4HB0LotT97B4/kVAkUkBTbVYgr76yb+tl eVv/KBBoyIuLBTzL4MNGc8irbvNfhn9fhCipA7tkyDsoCYnynpcgcqOUSq3b3+GAJwxA N/sA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="Xq/zF1vL"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="BwQh/Rwq"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=U46v5sLJ; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=wXQzJIeN; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-486a906b4f5si251531fac.15.2026.09.17.08.30.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2026 08:30:32 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="Xq/zF1vL"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="BwQh/Rwq"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=U46v5sLJ; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=wXQzJIeN; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:Message-ID:Date:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=RjbOgVN2jD0hO2qppD1xYaq857xqUVarzlljS0AMLjc=; b=Xq/zF1vLUvfmET+lExX01qyX75 yGCSwoJYa5wWHP8KPmfSL5bI5kqWkbNe+HbCJrcZrOEMV0g3PkNx39BT0OmUEyra3lhx2zQI0ym9J sAucQqKnRj+j0zRw8HXncEUlFHDn1fTYTJshAwxo28UpkWiboiL33qYsRGUA5L8x62VY=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1x7E4A-0003gg-IF; Thu, 17 Sep 2026 15:30:24 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1x7E47-0003gX-Qt for openvpn-devel@lists.sourceforge.net; Thu, 17 Sep 2026 15:30:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ft9zvP0DKGz2b8hx+GzjzacYzy76KbyxWGbo9aEIQRM=; b=BwQh/RwqN4NoiSG8pMEJQD6y+l RlRHdoeYZv6oVf0VlS2VPoSV4MGejmfOZfRbiX9uuzKG0xXmbS59mRz7Kp3lh/DftH79z5XvPhjwC bbkJpAV9Ut+UnQe2f5RlBliWjM+MnmyTzKlDeefdWB7WqH6r0bHDi6gymgEgUPDqk+Ho=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=ft9zvP0DKGz2b8hx+GzjzacYzy76KbyxWGbo9aEIQRM=; b=U 46v5sLJS3F0dIe3pRkaFuUoO4PA3+mDv2Yp0WF3w2S5t08xEeMgeqosGUjwxfhSJOnHOqnnWqzAJ1 ivMfnpGJfkqWw5eFWe3hTEDdZTtjTj00nGKWPlfdzTtbQzHxmNReGXdVXKEb+6ygoOKOe7tIIUM2w JhivqFy+wDmB9540=; Received: from mout-b-105.mailbox.org ([195.10.208.50]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1x7E41-0005Yj-0W for openvpn-devel@lists.sourceforge.net; Thu, 17 Sep 2026 15:30:21 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-105.mailbox.org (Postfix) with ESMTPS id 4hm07P0VY9z9sYv for ; Thu, 17 Sep 2026 17:30:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1789659009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ft9zvP0DKGz2b8hx+GzjzacYzy76KbyxWGbo9aEIQRM=; b=wXQzJIeNwXV6NX7JZMgHoQKPHYwXyAm/GIQFhTmnTAu3egUHMdbb7yBKrMzvLa7RV0YPFi zYA5re5CR81ig2di79vXgCW0opTOxbMuhdLlDSeP7SozpIaOrNiXyvkk2BgLRFcVDhy1HX FXNo1WUJPIzW+u//s47jKI708zNyazzMPieuLdZg6H+cYoKtLj9+a9OSYdfV/aln6o67Hj FjKNuVgWvNEuHBT1G+CYg22qKhoWxMMetGROA8vDK+/58qGNq2+5BG+grdwQ2cibIotURy 8mBMsuwB55LfGVf1RGjZE5r9/S3H10/osiTa6+gcSfWDI5IrFu3Mj7bo5z+Efw== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::202 as permitted sender) smtp.mailfrom=ralf@mandelbit.com From: Ralf Lici To: openvpn-devel@lists.sourceforge.net Date: Thu, 17 Sep 2026 17:29:54 +0200 Message-ID: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4hm07P0VY9z9sYv X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi, Currently ovpn holds peer and key-slot references while packets are being processed and until asynchronous crypto completes. With traffic for one peer spread across CPUs, the shared kref cachelines th [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [195.10.208.50 listed in wl.mailspike.net] X-Headers-End: 1x7E41-0005Yj-0W Subject: [Openvpn-devel] [PATCH ovpn net-next 0/2] ovpn: reduce reference-count contention X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1876593509786979551 X-GMAIL-MSGID: 1876593509786979551 Hi, Currently ovpn holds peer and key-slot references while packets are being processed and until asynchronous crypto completes. With traffic for one peer spread across CPUs, the shared kref cachelines therefore become contended even though both objects are normally long-lived. This series converts both references to percpu_ref while preserving their existing RCU-delayed destruction. The individual patch messages describe the memory cost and cache-to-cache measurements. The test used one peer, one AES-128-GCM key and 32 TCP streams on a 32-logical-CPU Ryzen 9 9950X with a ConnectX-5 hairpin. The encrypted RX flow used one source port and one receive queue, so only TX exercised CPU fan-out. perf c2c showed that each shared reference cacheline disappeared after its respective conversion. Thanks, Ralf Lici Mandelbit Srl --- Ralf Lici (2): ovpn: use percpu references for peers ovpn: use percpu references for key slots drivers/net/ovpn/crypto.c | 14 +++++++------- drivers/net/ovpn/crypto.h | 15 +++++++++++---- drivers/net/ovpn/crypto_aead.c | 7 ++++++- drivers/net/ovpn/netlink.c | 6 +++--- drivers/net/ovpn/peer.c | 32 ++++++++++++++++++++------------ drivers/net/ovpn/peer.h | 34 ++++++++++++++++++++++++++++++---- 6 files changed, 77 insertions(+), 31 deletions(-) base-commit: b8e9e7d82e7eefd5d2d528469d94ec20e96b38c3