All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: netdev@vger.kernel.org
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>
Subject: [PATCH net-next v3 12/13] selftests: net: fib_tests: Add stale pcpu test
Date: Tue,  1 Dec 2026 10:40:13 -0700	[thread overview]
Message-ID: <20261201174021.7211-13-dsahern@kernel.org> (raw)
In-Reply-To: <20261201174021.7211-1-dsahern@kernel.org>

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)


  parent reply	other threads:[~2026-12-01 17:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 17:40 [PATCH net-next v3 00/13] ipv6: validate cached dsts against the netns route generation David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 01/13] ipv6: allocate the exception entry before removing the one it replaces David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 02/13] ipv6: keep a superseded pcpu dst working until its holders notice David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 03/13] ipv6: don't insert a PMTU exception whose MTU could not be stored David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 04/13] ipv6: invalidate the failing dst in ip6_link_failure() David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 05/13] ipv6: tell route dumps about exception inserts with a table sequence David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 06/13] ipv6: validate dsts against the netns route generation David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 07/13] ipv6: make rt_genid_bump_ipv6() a plain counter increment David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 08/13] nexthop: factor out nh_has_f6i() David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 09/13] nexthop: bump the IPv6 route generation on group changes David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 10/13] ipv6: stamp dsts with the generation sampled before the FIB lookup David Ahern
2026-12-01 17:40 ` [PATCH net-next v3 11/13] selftests: net: pmtu: check that a deleted cached exception stays deleted David Ahern
2026-12-01 17:40 ` David Ahern [this message]
2026-12-01 17:40 ` [PATCH net-next v3 13/13] selftests: net: ipvs: check a PMTU learned after the DR route was cached David Ahern
2026-12-01 17:43 ` [PATCH net-next v3 00/13] ipv6: validate cached dsts against the netns route generation netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201174021.7211-13-dsahern@kernel.org \
    --to=dsahern@kernel.org \
    --cc=dahern@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=ja@ssi.bg \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ralf@mandelbit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.