Article View: linux.kernel.netdev
Article #22915Re: [PATCH net-next] xfrm: remove three registration spinlocks
From: Steffen Klassert
Date: Thu, 26 Nov 2026 06:31
Date: Thu, 26 Nov 2026 06:31
30 lines
10563 bytes
10563 bytes
On Thu, Nov 19, 2026 at 12:07:15AM +0100, Eric Dumazet wrote: > xfrm_state_afinfo[], xfrm_translator and xfrm_mode_cbs_map[] are > RCU protected pointers which are only written when a module or an > address family registers or unregisters itself. All their readers > already use rcu_read_lock() and rcu_dereference(), and the unregister > functions already call synchronize_rcu(). > > Each of them has a dedicated spinlock which only serializes these > rare writers: > > - xfrm_state_afinfo_lock and xfrm_translator_lock make "install if > the slot is empty" and "clear if the slot is ours" atomic. Use > cmpxchg() instead. The return values are unchanged: -EEXIST if the > slot is already used at registration, -EINVAL when unregistering > while another object is installed, 0 otherwise. > > - xfrm_mode_cbs_map_lock protects nothing: registration overwrites > the slot and unregistration clears it, both unconditionally. Remove > it, the existing behavior is kept. > > Tested with the xfrm_policy.sh and xfrm_state.sh selftests. The > translator code was only compile tested, with > CONFIG_XFRM_USER_COMPAT=y, and the unregister paths were not > exercised. sparse (C=2) reports no warning. > > Signed-off-by: Eric Dumazet <edumazet@kernel.org> > Cc: Steffen Klassert <steffen.klassert@secunet.com> Applied to ipsec-next, thanks a lot Eric!
Technical Details
Message-ID:
<awfSWovE7zDwHYpk@gauss4>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371895-linux-kernel-netdev=dewy.ruReferences:
<20261118230715.1630439-1-edumazet@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371895-linux-kernel-netdev=dewy.ru From: steffen.klassert@secunet.com (Steffen Klassert) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next] xfrm: remove three registration spinlocks Date: Thu, 26 Nov 2026 07:31:54 +0100 Organization: Usenet Network Message-ID: <awfSWovE7zDwHYpk@gauss4> References: <20261118230715.1630439-1-edumazet@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Injection-Info: usenet.network; logging-data="398987"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Ro9P6Yfm+m6uMaVRpHFA4MTImzk= sha256:0WTfTqNcoWmsPf5I4aVJKpzZOb+AOwSWOZKLgPPk8BM= sha1:0ou5UxCqEUDRgjU0y4aP/DNs9/8= sha256:pNQLew/TEiHL3+MNaLzxfNeR4rK0aU/JMFje0pQhDkQ= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 4C9CD125EB2; Thu, 26 Nov 2026 09:32:18 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=secunet.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 97vhYNxCzCG1; Thu, 26 Nov 2026 09:32:15 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-371895-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=secunet.com X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 0E308125EAE; Thu, 26 Nov 2026 09:32:04 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 1A4E1606163; Thu, 26 Nov 2026 06:32:04 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795674721; b=lxCHau8sulg8YZcT3p7hQWLaaupOXMzpwx3dLgitQUKdMXddnOSzQrW7v2jnCOFup/9u KRLKE20wwSNMWFlx2dlcAMhCFUNEYYu6vd/cI+LI9hniNcy8SuRZ2Ztas+gkra3mMYG/K NKMl7nFyK8aPVwyHRvm54+bw1/IKLVDmroAMwy9QFMFmQT3KnJyyQdOya8Ca6+Z7jJEAB IS07H040moBI4v3FphBIlL3c+QRJ4r5vylpH7e77pSITGpFC3kwrbeHKnbDGUyyhzM0C1 UZkOwwWozO2R6O6lrcxfZDSF27fJPUaChLZL6A2AYHllPxj+OyUgwI48fXd+aDyOQuA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795674721; h=X-Original-To:Received:DMARC-Filter:Received:X-Virus-Scanned: Received:Received:DKIM-Filter:DKIM-Signature:Received:Received:Date: From:To:CC:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To: X-ClientProxiedBy; bh=Rz3OtAkC4oLPUzZvo2Fsc4gS4L47l7wc9Xn1pL2Qe2Y=; b=ZD1F1IzdcBP4oWw6tWJIRm6P98mMUYg/xxD8/keKlFd7Am8ZrT/8qrA6V9Zur8yvbrZA 3owya4Kws3nCewv/llf3XrBhb20tidHFwH4agFJsrAu4jQfWjNWo3ucOqQgjZvcFXSTZh 6kwV0Vrtk5OF7PQs1y253q9/t0UsAvFBcyJABrT5JmFMe6wtvhPNge0Lppn7ICesJts25 Rvui/QbwU42hOTUxYHn44x/8nvGE+PXn399kJi8WP17W+LiAZDRK3EkLAuZdZMd8z1v5O id5+GfsCsMWI1U1czn7nKBahH6b8bnhmFI3Qh6iztD8VmD6MGtKG+7QLsiLdqwgy/cg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=TMGxR2el; dmarc=pass header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6883F606A330; Thu, 26 Nov 2026 06:32:01 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=TMGxR2el X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795674720; b=X3dTuaJxuIbq91CswfzXGJGQar/zMRbzBRcacwbdQUhI0488d5FCm8pYJPtgPHnJGjld z9QOCY4xnWMEf/eJqSfNLdpfBl5jsa8g6KA8yaT55Ogm796mer+xdbGsZDsmI6S7bIWj0 fOBVkEVV01vLNEwR/ecaPU3728eNGfiztdpH7RFIvGHFTnxUFFRDe1m77i7ZErOGEwtK0 vLdib8wi4ugYIIe7UEHNGC79F1gLXhX8nKxODpbY7RIyINshlPguqWxGEYskJg0DQ+mjN Ru27ZUHPQApMiBszCkk1rCmkD/z4h/H+NS47Ppoiq9JCa8X8PWkmYeuyiGWbeqg+oFw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795674720; h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter: DKIM-Signature:Received:Received:Date:From:To:CC:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To: X-ClientProxiedBy; bh=Rz3OtAkC4oLPUzZvo2Fsc4gS4L47l7wc9Xn1pL2Qe2Y=; b=GPujmfCgoORHsBRY7WLGUFBvdASQZk6wXOFm68sTFO8Z29bNXCcsxbcGdFp3Y0i8QicV 3b3BIFnbwzC68ZDISH2VUioO3UMRaPgSxUcASF/0qdkb719uiWvm7PnrCGjt0jYTNNAr9 Z718+ZYbeMkPgMQsICxAjiN260U0B/tC15BL6hcuhVOPshscTLyAcvF4OJapnbm+9VLnx 0eRVB5gDKLdNIMoceJpO8snpK+qMiUaERHKLIO4YlJ3n6YY+HsHIrWC36BooRoWpdi/P7 MdXxvoentetDxiAJnDVdAgxO5ZShCpjp5uk8CXexiWGpf4Si7obGwOyjZjJBiVugN4A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=TMGxR2el; arc=none smtp.remote-ip=62.96.220.36 X-Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7608F606A321 for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 06:31:59 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7608F606A321 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com X-Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 72E0920851; Thu, 26 Nov 2026 07:31:57 +0100 (CET) X-Virus-Scanned: by secunet X-Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A3tkRXbW73jW; Thu, 26 Nov 2026 07:31:56 +0100 (CET) X-Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id 47D4A20758; Thu, 26 Nov 2026 07:31:56 +0100 (CET) X-DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 47D4A20758 X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1795674716; bh=Rz3OtAkC4oLPUzZvo2Fsc4gS4L47l7wc9Xn1pL2Qe2Y=; h=Date:From:To:CC:Subject:References:In-Reply-To:From; b=TMGxR2elwX4796YutfoWb8vx9B/otCp23iYCXRHRrz6UxVo5htQtDHtQMxnmJvYat 9mVkQfks7vcRdcwkpBkZVzCrhiH52jBfRdNJQKoynsajtcSVffasUBtsSMvS7DRygT BSQZpq03bStS6ZVvTBFy+Y0MqoGxCaXWzy0Eknj3vYqKORc6p7ZiPZubi568bcdT0j s0YQRpl/hHuZdLSVwqZcVcQ4eX7NgZxIDSX09Q59Dw7f4uNVuVH0yYIUBmQpTbRYzB UjtY7aIdoHIz/MIhxNqNyWSdyFIQ/QyjyCkG4UHyGNzHH1b4VTdNG8pAyFNhpZoVsZ mTkzUqRiT6tpg== X-Received: from gauss4 (10.182.7.102) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Thu, 26 Nov 2026 07:31:55 +0100 X-Received: (nullmailer pid 1874143 invoked by uid 1000); Thu, 26 Nov 2026 06:31:54 -0000 X-CC: "David S . Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Willem de Bruijn <willemb@google.com>, Simon Horman <horms@kernel.org>, <netdev@vger.kernel.org> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261118230715.1630439-1-edumazet@kernel.org> X-ClientProxiedBy: EXCH-03.secunet.de (10.32.0.183) To EXCH-01.secunet.de (10.32.0.171)