🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25399

[PATCH net-next v3 12/13] selftests: net: fib_tests: Add stale pcpu test

#25399
From: David Ahern
Date: Tue, 01 Dec 2026 17:40
92 lines
10527 bytes
From: David Ahern <dahern@nvidia.com>

Avoid regression with stale pcpu route entries and add a selftest
that covers the regression fixed by
    8f34e53b60b3 ("ipv6: Use global sernum for dst validation with nexthop objects")

Signed-off-by: David Ahern <dahern@nvidia.com>
---
 tools/testing/selftests/net/fib_tests.sh | 53 +++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
index d7ac3c727f70..dc2ac5d7f29b 100755
--- a/tools/testing/selftests/net/fib_tests.sh
+++ b/tools/testing/selftests/net/fib_tests.sh
@@ -14,7 +14,7 @@ TESTS="unregister down carrier nexthop suppress ipv6_notify ipv4_notify \
        ipv4_mpath_list ipv6_mpath_list ipv4_mpath_balance ipv6_mpath_balance \
        ipv4_mpath_balance_preferred ipv4_mpath_oif ipv4_mpath_oif_nh \
        ipv4_mpath_oif_vrf ipv6_mpath_oif ipv6_mpath_oif_nh ipv6_mpath_oif_vrf \
-       fib6_ra_to_static fib6_temp_addr_renewal"
+       fib6_ra_to_static fib6_temp_addr_renewal ipv6_nh_pcpu_stale"
 
 VERBOSE=0
 PAUSE_ON_FAIL=no
@@ -3228,6 +3228,56 @@ ipv6_mpath_oif_vrf_test()
 	cleanup
 }
 
+ipv6_nh_pcpu_stale_test()
+{
+	local cpu
+
+	echo
+	echo "IPv6 nexthop object stale pcpu dst test"
+
+	if [ ! -x "$(command -v taskset)" ]; then
+		echo "SKIP: taskset not installed"
+		return $ksft_skip
+	fi
+
+	if [ $(nproc) -lt 2 ]; then
+		echo "SKIP: pcpu test requires multiple cpus"
+		return $ksft_skip
+	fi
+
+	setup
+
+	set -e
+	setup_ns ns2
+	$IP link add veth1 type veth peer name veth2 netns $ns2
+	$IP link set veth1 up
+	$IP -6 address add 2001:db8:10::1/64 dev veth1 nodad
+	ip -netns $ns2 link set lo up
+	ip -netns $ns2 address add 2001:db8:11::1/128 dev lo
+	ip netns exec $ns2 sysctl -qw net.ipv6.conf.all.forwarding=1
+	ip -netns $ns2 link set veth2 up
+	ip -netns $ns2 -6 address add 2001:db8:10::2/64 dev veth2 nodad
+
+	$IP -6 nexthop add id 100 via 2001:db8:10::2 dev veth1
+	$IP -6 route add 2001:db8:11::1/128 nhid 100
+	set +e
+
+	# create a pcpu dst entry on cpu 0
+	taskset -a -c 0 $IP -6 route get 2001:db8:11::1 &> /dev/null
+
+	# re-add the route entry
+	$IP -6 route del 2001:db8:11::1
+	$IP -6 route add 2001:db8:11::1/128 nhid 100
+
+	# cached dst on cpu 0 must have been invalidated
+	for cpu in 0 1; do
+		taskset -a -c $cpu $IP -6 route get 2001:db8:11::1 &> /dev/null
+		log_test $? 0 "Route get on cpu $cpu after route re-add"
+	done
+
+	cleanup
+}
+
 ################################################################################
 # usage
 
@@ -3322,6 +3372,7 @@ do
 	ipv6_mpath_oif_vrf)		ipv6_mpath_oif_vrf_test;;
 	fib6_ra_to_static)		fib6_ra_to_static;;
 	fib6_temp_addr_renewal)		fib6_temp_addr_renewal;;
+	ipv6_nh_pcpu_stale)		ipv6_nh_pcpu_stale_test;;
 
 	help) echo "Test names: $TESTS"; exit 0;;
 	esac
-- 
2.54.0 (Apple Git-157)
Technical Details
Message-ID: <20261201174021.7211-13-dsahern@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375264-linux-kernel-netdev=dewy.ru
References: <20261201174021.7211-1-dsahern@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375264-linux-kernel-netdev=dewy.ru
From: dsahern@kernel.org (David Ahern)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v3 12/13] selftests: net: fib_tests: Add stale pcpu test
Date: Tue,  1 Dec 2026 10:40:13 -0700
Organization: Usenet Network
Message-ID: <20261201174021.7211-13-dsahern@kernel.org>
References: <20261201174021.7211-1-dsahern@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1780370"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FGlN/CwykgAdEw1osXO8OSODwMc= sha256:Qd+J+w3ne2ZznjyT0frqPg30iEDznfuGh0BVvXF82lw=
	sha1:HBr4f8BBvUHZH9uvMlHODR/Su2w= sha256:0Nw/BG1pJEddvGa1akX7L0ES57LG9HG2hzK8j271eyY=
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 78BF5117446; Tue,  1 Dec 2026 20:41:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 (2048-bit key)
	header.d=kernel.org
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 utJw2ADCGgkf;
	Tue,  1 Dec 2026 20:41:41 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-375264-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 916F0117440; Tue,  1 Dec 2026 20:41:33 +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 B1B2B28985; Tue,  1 Dec 2026 17:41:25 +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=1796146869;
	b=lsDzK4iPtEY+cbVJRcW8bxiSoxqeD03JoQRxfDxwoVWuIh4dSWbfAkacpo02ChOEJeAY
	 y2QlDOouwKMaQfiJbjTeBnkPpnmQonDQ+/KG4f461m4cCBbM8GbBK7MIbmwK9TeFg5GtT
	 DTzgNPJF9SRepYYaSDoZq0dQw+f66GujFzcnZ9zUgEI8QbP4qMk2dZM0oI816P+PLWEyU
	 Okz7vDh+H5s2/Qa617qwJ2Va0ks68v6dQHDq86+6JPu74SU/mTzw7VjGggLVsB55Jw9+d
	 Ud9alLREKZ0EXZ5Cf2g8tcnf8Bau+DHw8WXKeetxoUlBMKcXMUroN5mbpUk6UB/pe5w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796146869;
	h=X-Original-To:Received:Received:DKIM-Signature: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=Ggltb7RoF9HsjuZzJaLHwGvo3eh4NABtovn8kGjeIQ8=;
	b=KL81SpjwDsyMiUQvLLGlnTmfmgaJOk20HFXEvKpT2RNoqBHYscPFxi41rRkEEHXc7fLX
	 bcSuSiXFTuwBFpgfqnh3VAdrjP22TgPT8bhcB6SH9BKWiRmMGfx3luDaQX/19Iup7w+Iq
	 UkTITzL3Xj1I0XQq6RFSYqL16NqR3oEtavODqN7z8lBj6QhPlEjCPdiEbs2nbOubm/BTF
	 o6nUcrdkvpuD+7KeNRkAOj9XS+oBgWMNZ0xDZOj0lgKu+XWY132q0Vdi7m0bdIHrwm0mm
	 1AyVO7xfx/nqoBksFqWN7h9pMhERMsbYxbVSuyM2wI4/t7GrXrdkBH3K8dDycFGISeQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=UmdGLM0k;
	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 8F85760A2612;
	Tue,  1 Dec 2026 17:41:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=UmdGLM0k
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796146868;
	b=E+jsYwZIdtHubmphU3M+Bmheo50Dx0sPD+z7SFzA8SPE0VlWbjDn0YB6ZR3lg3En6SK2
	 6YVq2mK+weOIEIm0iRl3gDtD6i2nhK+HGbRZYX538JdxsgH8ntmGhVnatQSzu7r6x/Yvr
	 Ctc+VEfMYZk8VPGaJ0kIN5ju/i0d39s3ntDvH8p0E2tXUw1An6/bX82+B6mFrZrItFMwi
	 KUZHPt5/MGJID7aLyYXvHOnqAwzaYZeNfG6NcCMxWzbyHd5h0q2JPozGHNACWf7Tio8lI
	 Pa1MOBGYJPjJJuR3ZXLsdBYZcpVrkTP3+Dm3jsVVverLXWGpXhqOv1hyqhnnFARQEgA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796146868;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Transfer-Encoding;
	bh=Ggltb7RoF9HsjuZzJaLHwGvo3eh4NABtovn8kGjeIQ8=;
	b=IBMYyDIy+7y7BUnp6WF2O8ywCt2PxnxwhsixrciOwW83Q+oBEoXCsnW+MJoEUf/KcM3K
	 o5RhCWGEbgnJ2m6bYLSJPcJYg+anUwGRPNZZuvSsWKAtNJ6e6cqQOnXy9bjBl39PCOt5o
	 zIAZPf+ea5JbvecjbCPK8KUxSXdMf8wcgZp0uWuGoDsnSkglS/yhgM149YzV1GCDK0fsU
	 24Qn7jzMc+JoNQlXB5r41BqzykqMwmH3QZ/SkD5nhnSILdmIrSGwe2VALy5WLcJfT28Lx
	 laFolU66qjpl2GTOpjq4doj/+dP9qLekoO8V5jEs/07iipcOn2VhUqOljAIyrur2JKQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=UmdGLM0k;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B15C9606A322
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 17:41:08 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9D8D1F00939;
	Tue,  1 Dec 2026 17:41:07 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796146868;
	bh=Ggltb7RoF9HsjuZzJaLHwGvo3eh4NABtovn8kGjeIQ8=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=UmdGLM0kOz5v2r+EXE4ndJEZBfQa0Lpwh7XRhTrdAaNMWkSWProoxSDXJHf3mdYv1
	 dXyLfGiY/VuFtK666/CMenz9VKWkjn/k/4zE8oQ3z1d1pGd04Q4RJcZr00i6WTkdOE
	 5Sehvm/b9soZzLdBrjQOLf1vTZwgPzfCy5uvo9ZGwqudZOJYIZikBdwmG9m7WTdFpC
	 pgEWuOQ1SYx2M4Rg0pOOpodf5GqiDXPY1Xxj8OE4GJWhRnbtWjylE15lP5t6tFujaC
	 Efxw4m2ZOCTDqhPTLcrpYKCHjdYtLkdoYMR7M3bSWHgI9iM7yfMkrSbBE/75Zu4sbk
	 anFas1Bnho2Sw==
X-Cc: dsahern@kernel.org,
	idosch@nvidia.com,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	horms@kernel.org,
	ralf@mandelbit.com,
	ja@ssi.bg,
	David Ahern <dahern@nvidia.com>
X-Mailer: git-send-email 2.54.0
X-In-Reply-To: <20261201174021.7211-1-dsahern@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