From: Ido Schimmel <idosch@nvidia.com>
To: David Ahern <dsahern@kernel.org>, ralf@mandelbit.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
ralf@mandelbit.com, ja@ssi.bg
Subject: Re: [PATCH net-next v3 00/13] ipv6: validate cached dsts against the netns route generation
Date: Thu, 3 Dec 2026 17:34:47 +0200 [thread overview]
Message-ID: <20261203153447.GA3201592@shredder> (raw)
In-Reply-To: <20261201174021.7211-1-dsahern@kernel.org>
On Tue, Dec 01, 2026 at 10:40:01AM -0700, David Ahern wrote:
> Known costs and limits:
> - Every FIB change bumps the generation of the netns, so every exception
> becomes stale and is replaced by a copy the next time traffic uses it.
> That is an allocation per exception revisited, and the replacement takes
> rt6_exception_lock, which is global. The entry and the writable
> metrics are allocated before taking it.
>
> - An exception insert still scans the nexthop's whole dirty cpumask,
> nr_cpu_ids bits, though it only touches the dsts of CPUs that built one.
Another cost is related to the structural difference between IPv4 and
IPv6. The cost of rebuilding cached dst entries in IPv4 is lower
compared to IPv6.
Legacy / inline IPv4 nexthops are consolidated by the kernel when
possible, which limits the number of nexthops and therefore the number
of dst entries that need to be rebuilt each time. In IPv6 each route has
its own nexthop, which means that each bump of the per-netns counter
invalidates many more dst entries (up to the number of active routes
times the number of CPUs). Today, per-CPU dst entries of such routes are
not rebuilt following FIB changes, so this is also a new cost for the
forwarding path.
So, I think Ralf's v5 [1] is a better approach and also easier to
review: Keep the per-node validation for inline nexthops and per-netns
validation for nexthop objects.
A few comments on his series:
1. "ipv6: stamp the default route node with a fresh serial on link
failure" is not strictly related to the other patches and should be
submitted separately and without a Fixes: tag given this is not a
regression.
2. Invalidating live per-CPU dst entries by calling dst_dev_put()
introduces the same problem that was fixed in IPv4 by commit
5018c59607a5 ("ipv4: fix race condition between route lookup and
invalidation") and commit ae89f2724db1 ("ipv4: route: don't blackhole
in-use routes when retiring fnhe routes").
Better to move these dst entries to the uncached list, which requires
handling [2] first.
3. In patch 3, stamping a dst entry with 0 due to a mismatch in the
per-netns counter is too coarse. Any FIB change in the netns (e.g., a
route inserted into a different table) causes the lookup to replace a
valid per-CPU dst entry whose route did not change.
We can sample the per-netns counter before the lookup and use it to
stamp new dst entries. A dst entry is then valid as long as its serial
number is equal or newer than the node's serial number, and the per-CPU
dst entry is only replaced when it is no longer valid. This also avoids
the second read of the counter.
[1] https://lore.kernel.org/netdev/cover.1795537128.git.ralf@mandelbit.com/
[2] https://lore.kernel.org/netdev/20261202161942.GA2800642@shredder/
prev parent reply other threads:[~2026-12-03 15:35 UTC|newest]
Thread overview: 19+ 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-02 16:02 ` Ido Schimmel
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-02 16:19 ` Ido Schimmel
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 ` [PATCH net-next v3 12/13] selftests: net: fib_tests: Add stale pcpu test David Ahern
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
2026-12-02 9:45 ` Ralf Lici
2026-12-03 15:34 ` Ido Schimmel [this message]
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=20261203153447.GA3201592@shredder \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox