mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: ralf@mandelbit.com
Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, ncardwell@google.com,
	kuniyu@google.com, steffen.klassert@secunet.com,
	herbert@gondor.apana.org.au, fw@strlen.de,
	yanxia@cmss.chinamobile.com, sd@queasysnail.net,
	antonio@mandelbit.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 1/5] ipv6: stamp the default route node with a fresh serial on link failure
Date: Tue, 24 Nov 2026 10:26:51 +0000	[thread overview]
Message-ID: <179551601105.3135.14543779680619984305@kernel.org> (raw)
In-Reply-To: <79fea581787dd175005d81090d246e982a07cc51.1795166508.git.ralf@mandelbit.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The patch makes ip6_link_failure() (net/ipv6/route.c) do much
  more work for an RTF_DEFAULT, non-RTF_CACHE dst.

--

ipv6: stamp the default route node with a fresh serial on link failure

This commit changes ip6_link_failure() so that it no longer writes -1 into
fn_sernum of an RTF_DEFAULT route's node. It now calls fib6_update_sernum()
under tb6_lock, which allocates a fresh serial and advances the netns-wide
fib6_sernum generation. The changelog says the extra cost happens once per
queued skb when the neighbour of the default router fails.

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 4a4c5ace63c54..bbe6d67bb6964 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c

[ ... ]

> @@ -2873,13 +2875,13 @@ static void ip6_link_failure(struct sk_buff *skb)
>  			rt6_remove_exception_rt(rt);
>  		} else {
>  			struct fib6_info *from;
> -			struct fib6_node *fn;
>  
>  			from = rcu_dereference(rt->from);
> -			if (from) {
> -				fn = rcu_dereference(from->fib6_node);
> -				if (fn && (rt->rt6i_flags & RTF_DEFAULT))
> -					WRITE_ONCE(fn->fn_sernum, -1);
> +			if (from && from->fib6_table &&
> +			    (rt->rt6i_flags & RTF_DEFAULT)) {
> +				spin_lock_bh(&from->fib6_table->tb6_lock);
> +				fib6_update_sernum(rt6_exception_net(rt), from);
> +				spin_unlock_bh(&from->fib6_table->tb6_lock);

[Severity: Low]
Is the cost of this path limited to neighbour failure, as the commit
message says?

  This happens once per ip6_link_failure call, so once per queued skb
  when the neighbour of the default router fails.

Several tunnel transmit error paths call dst_link_failure(skb) once per
packet. For an IPv6 inner packet the inner route's dst is still attached,
so they reach ip6_link_failure():

  ipip6_tunnel_xmit() in net/ipv6/sit.c:
  tx_error_icmp:
	dst_link_failure(skb);

This one is taken when ip_route_output_flow() fails or when the underlay
route is not unicast or local.

  ip6_tnl_xmit() in net/ipv6/ip6_tunnel.c:
  tx_err_link_failure:
	DEV_STATS_INC(dev, tx_carrier_errors);
	dst_link_failure(skb);

This one is taken when ip6_route_output() returns dst->error, when
xfrm_lookup() fails, or when ip6_tnl_xmit_ctl() fails. skb_dst_set() runs
later than this, so skb_dst is still the inner IPv6 route here.

ip_tunnel_xmit() in net/ipv4/ip_tunnel.c also reaches tx_error_icmp in the
NBMA case when the IPv6 next hop is not v4-compatible.

There are also the err_count paths in ip_tunnel_xmit(),
ipip6_tunnel_xmit() and ip6_tnl_xmit():

	WRITE_ONCE(tunnel->err_count, err_count - 1);
	dst_link_failure(skb);

These run once per ICMP error received for the tunnel, so a remote host
can drive them.

RA-learned default routes carry RTF_DEFAULT, for example a default router
learned over ISATAP/sit, gretap or ip6gretap. pcpu copies keep the flag
through ip6_rt_copy_init().

While the underlay is broken, wouldn't every IPv6 packet sent through
such a route take tb6_lock with BH disabled? Each one would also run
fib6_new_sernum()'s atomic_try_cmpxchg on net->ipv6.fib6_sernum.

tb6_lock is the same lock that route insert/delete, GC and PMTU exception
insertion use. Each generation bump also invalidates every nexthop-object
dst in the netns, because rt6_is_valid() checks those against the netns
generation. Later in the series, ip6_dst_lookup_flow_cookie() returns
cookie 0 to socket lookups that race with a bump.

These are error paths where the traffic is already being dropped. Also,
rt6_insert_exception() already takes tb6_lock and bumps the generation on
remotely triggered PMTU exceptions. Still, the cost here seems to scale
with packets on these tunnel paths, not with neighbour queue length.

Could the changelog mention these callers? Would it be worth
rate-limiting the bump, or skipping it when the node's serial has already
moved past the one the dst cached?

>  			}
>  		}
>  		rcu_read_unlock();

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795166508.git.ralf%40mandelbit.com

  reply	other threads:[~2026-11-24 10:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  9:36 [PATCH net-next v4 0/5] ipv6: tie the dst cookie to the lookup that returned the dst Ralf Lici
2026-11-20  9:36 ` [PATCH net-next v4 1/5] ipv6: stamp the default route node with a fresh serial on link failure Ralf Lici
2026-11-24 10:26   ` netdev-bot+sashiko [this message]
2026-11-20  9:36 ` [PATCH net-next v4 2/5] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown Ralf Lici
2026-11-20  9:36 ` [PATCH net-next v4 3/5] ipv6: validate the cookie of nexthop-object dsts in ip6_dst_check Ralf Lici
2026-11-24 10:26   ` netdev-bot+sashiko
2026-11-20  9:36 ` [PATCH net-next v4 4/5] ipv6: add ip6_dst_lookup_flow_cookie Ralf Lici
2026-11-24 10:26   ` netdev-bot+sashiko
2026-11-20  9:36 ` [PATCH net-next v4 5/5] ipv6: use lookup cookies in selected socket dst cache paths Ralf Lici

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=179551601105.3135.14543779680619984305@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=antonio@mandelbit.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=fw@strlen.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ralf@mandelbit.com \
    --cc=sd@queasysnail.net \
    --cc=steffen.klassert@secunet.com \
    --cc=yanxia@cmss.chinamobile.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

all inboxes | Powered by JetHome®