🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20012

Re: [PATCH net-next v4 2/4] ipv6: take fib6_sernum from a sequence shared by all netns

#20012
From: Qiliang Yuan
Date: Fri, 20 Nov 2026 23:13
30 lines
9572 bytes
Hi Ralf,

On Fri, Nov 20, 2026 at 06:52:41PM +0100, Ralf Lici wrote:
> What the atomic_set
> changes is the ordering. It comes after the full barrier of the cmpxchg,
> so nothing orders it before the node stamp in fib6_update_sernum: a
> reader can sample the new fn_sernum while still reading the old
> generation (this one is allowed on arm64).
[...]
> The late store also loses the guarantee that a reader seeing a value
> sees the routing changes published before it.
[...]
> Drawing from the shared sequence but publishing with a cmpxchg on the
> per-netns counter keeps both, at the cost of a wasted draw on
> contention:

Thanks for the careful review. I wrote both cases as litmus tests and
herd7 agrees: the stale generation and the late store of a smaller
value are both reachable with atomic_set() and forbidden once the
value is published with atomic_try_cmpxchg() on the per-netns counter.

> 1/4 has the same pattern for rt_genid, and IPv4 bumps can run
> concurrently too, since xfrm policy insertion does not hold RTNL.

Right. I'll publish with a cmpxchg in both 1/4 and 2/4 in v5, as you
suggested, and Cc you on it.

Thanks,
Qiliang
Technical Details
Message-ID: <20261120231353.4189980-1-qiliang.yuan@linux.dev>
Path: mbox-mo1.pugleaf.net!srl.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-368200-linux-kernel-netdev=dewy.ru
References: <20261117-bug-net-netns-move-rcu-barrier-v4-0-43e1ca0aac7f@linux.dev> <20261117-bug-net-netns-move-rcu-barrier-v4-2-43e1ca0aac7f@linux.dev> <20261120175241.289834-1-ralf@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.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-368200-linux-kernel-netdev=dewy.ru
From: qiliang.yuan@linux.dev (Qiliang Yuan)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 2/4] ipv6: take fib6_sernum from a sequence shared by all netns
Date: Fri, 20 Nov 2026 18:13:53 -0500
Organization: Usenet Network
Message-ID: <20261120231353.4189980-1-qiliang.yuan@linux.dev>
References: <20261117-bug-net-netns-move-rcu-barrier-v4-0-43e1ca0aac7f@linux.dev> <20261117-bug-net-netns-move-rcu-barrier-v4-2-43e1ca0aac7f@linux.dev> <20261120175241.289834-1-ralf@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3289165"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wxrevVXQE21YXWc/3+oLEJVjPLY= sha256:R/neFVAkdgwxJlcI8rwg+ysYwTu7HnbjkmdA+vAiEw8=
	sha1:ZFsArQvPTqcYhbvw+JPJg63U20o= sha256:NaqpqFql07mbVf+iNrD6MdP4lM0jcpqYRM2kY7oGzNE=
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 71329115ABC; Sat, 21 Nov 2026 02:14:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.dev
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 V1frGU3SGFOC;
	Sat, 21 Nov 2026 02:14:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-368200-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id EF752115ABF; Sat, 21 Nov 2026 02:14:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 13F4A262BD; Fri, 20 Nov 2026 23:14:13 +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=1795216451;
	b=j29MvZmuw9L9aI6oyewrJPYgoCHH2+f7I+ITrnT4GW1PfhUBiuxysZNyAllPTDBk89jW
	 DIVspUvSfSGtGCThmp99knfcLmIQklalfm00Byx792kgXokVFIlIBdNPqIJEhCtXEUi0G
	 jl9ZfWkul7umgnAlVFjO01Xdb94tM0RkPZ2xqJcRzeBnrv/DcqPy7auClZhZzZb2SojWJ
	 dKwCd3wqoz4Pw4qnYrjKqtUaZL4sh2D7HL2UxlVhrcthbTAAqoWzYVAe3Oy+CXQQTGpSe
	 OJlFWJc3YAilk2uAIaQABzPsyRR1soCiPJ3hDI/bGY1qoWCthE8A3kUfxUcuwwuPMqQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795216451;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:
	 Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=pbzULJXRQ2wCr9lbRVnvc7ssE8ui2PghOhpvECt+S+Q=;
	b=Ffq1dSMUCEPjWLux2Jiyf3mdmPhIg22dGm6bqT5yVxzrLg+DFGwGuMifADi9BOJ390Ih
	 Fr6KQGj4l+UV9yw6wAPxDlrQ7sV9/bSuG9BuHggfsWM1rdApXr0v5KvE8w0wN+NdhtpGE
	 E63fzPWQ5Ofoux6dvpv28EdEskZ05xtrKURDGuckVi7a5vWyAcv39Z0j0OXNjav6B2TBM
	 8LO0ULJIw7oRmTIVfc9PQV2Y7ASSJXMvT43Xhk4RPnFTJVX2to0AgvBtlGiLPM3Vg+sQY
	 pwz4C3vn74PrG5jo6AUYgw6VspUBCacadhTVS7/Q0kxcbx4eu6/H+5CtnHZ7axI0xKQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=d3DcsOsC;
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	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 341E2606A6A5;
	Fri, 20 Nov 2026 23:14:11 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=d3DcsOsC
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.41
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795216445;
	b=Bh9z2nOnnLh+U+z2nCbBU8pwpkgERwIegPtC+p0/rbayQvzILoj/PiR3pexFtbwKbEAR
	 +NVGKdCXv6cDJOnmO7Qlmq2wQKL0wxvXZYd9mThSrncJPEZ3cQSAddsYpN0eo/Tlrmqmy
	 rSbbXLbcme4daChobEDoYxr/PY8sVdh/0BXvjv+ZI2ilmtrVWCfFUKxORu19DUyaMDM3b
	 CUnbP2lSPb3w3ATCInD20E1WlJ1jlU3caUT2Sry6F08ptxadUIjOj7Ok+foAbTlYboIqf
	 nokpAo1e2uyK0nvxHaZjPBraVF++pgAwwZ5g4wUN8Rm+y/v6yz15E3aTq5Hd+RyoYtw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795216445;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=pbzULJXRQ2wCr9lbRVnvc7ssE8ui2PghOhpvECt+S+Q=;
	b=sNqHSmrP3mi+tL9xNJHc1f56xm2LqEXBNusd8kzLkkgDMXP8XI3VyNKxIXWHKilTeV+N
	 DyWZKghbCkSbt6a53u5ShZXiCyaaE2C3ZwG2P15byXCxCTlmxQo9Pk0YD/160KoWu2Rjk
	 LrCN/2+ONw4d8h20eJPGePAoHMlJyVhJkDWlGfSpT0gToB73FWYFhvwDCTisGZq3+MU5B
	 3HMKop04j/GQreG+W4rNXuG6t+6jBvZZW5BqBeisKdfPgQV48VSAm0GKUFrHdRxdm2erv
	 OEcPsN5VMgquXAwUAbXWNRx7SPRlpHpGlCdWsLSq0g3R5LazaZqyml9PZWnMP1Z2IJg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=d3DcsOsC;
	arc=none smtp.remote-ip=91.218.175.41
X-Received: from mta0.migadu.com (out-41.mta0.migadu.com [91.218.175.41])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F999606A687
	for <netdev@vger.kernel.org>; Fri, 20 Nov 2026 23:14:03 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5F999606A687
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=pbzULJXRQ2wCr9lbRVnvc7ssE8ui2PghOhpvECt+S+Q=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1795216442; v=1; x=1795821242;
 b=d3DcsOsCTUNgEzkQJDeozoJsEypOyZErLY2SAyZkW//ipSFsc/+IKBqwjoQ57NZLaxCBRzoK
 2qeeM0XIx90k628u8yiLjsT8DwXfzxwR0WkIgExg78sP0MXAgN1pC8hMOzVscNrlnj3x8BEWEQw
 6H6eHumAVMKS1ZQUaHn8fWvA=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by smtp.migadu.com with ESMTPS id 625310cc214a2384;
	Fri, 20 Nov 2026 23:14:02 +0000
X-Mizu-Trace-ID: 625310cc214a2384
X-Migadu-Flow: FLOW_OUT
X-Cc: Qiliang Yuan <qiliang.yuan@linux.dev>,
	davem@davemloft.net,
	dsahern@kernel.org,
	edumazet@kernel.org,
	horms@kernel.org,
	idosch@nvidia.com,
	kuba@kernel.org,
	kuniyu@google.com,
	linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org,
	pabeni@redhat.com,
	razor@blackwall.org
X-Mailer: git-send-email 2.43.0
X-In-Reply-To: <20261120175241.289834-1-ralf@mandelbit.com>
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