Netdev Archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Omid Ehtemam-Haghighi <omid.ehtemamhaghighi@menlosecurity.com>,
	netdev@vger.kernel.org
Cc: adrian.oliver@menlosecurity.com, Ido Schimmel <idosch@nvidia.com>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>
Subject: Re: [PATCH] net/ipv6: Fix kernel soft lockup in fib6_select_path under high next hop churn
Date: Wed, 15 May 2024 13:26:38 -0600	[thread overview]
Message-ID: <a21b8fb8-6615-47a2-89a4-4ba97922bd46@gmail.com> (raw)
In-Reply-To: <20240514040757.1957761-1-omid.ehtemamhaghighi@menlosecurity.com>

On 5/13/24 10:07 PM, Omid Ehtemam-Haghighi wrote:
> diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> index c1f62352a481..b4f3627dd045 100644
> --- a/net/ipv6/ip6_fib.c
> +++ b/net/ipv6/ip6_fib.c
> @@ -1037,7 +1037,7 @@ static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn,
>  	fib6_drop_pcpu_from(rt, table);
>  
>  	if (rt->nh && !list_empty(&rt->nh_list))
> -		list_del_init(&rt->nh_list);
> +		list_del_rcu(&rt->nh_list);

This path is only for the separate nexthop objects (the rt->nh check),
while you seem to be dependent on the legacy IPv6 multipath code.


>  
>  	if (refcount_read(&rt->fib6_ref) != 1) {
>  		/* This route is used as dummy address holder in some split
> @@ -1247,7 +1247,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,
>  							 fib6_siblings)
>  					sibling->fib6_nsiblings--;
>  				rt->fib6_nsiblings = 0;
> -				list_del_init(&rt->fib6_siblings);
> +				list_del_rcu(&rt->fib6_siblings);

If using rcu for fib6_siblings fixes your problem, then all references
should be updated to annotate or use the rcu apis.


>  				rt6_multipath_rebalance(next_sibling);
>  				return err;
>  			}
> @@ -1965,7 +1965,7 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
>  					 &rt->fib6_siblings, fib6_siblings)
>  			sibling->fib6_nsiblings--;
>  		rt->fib6_nsiblings = 0;
> -		list_del_init(&rt->fib6_siblings);
> +		list_del_rcu(&rt->fib6_siblings);
>  		rt6_multipath_rebalance(next_sibling);
>  	}
>  
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 1f4b935a0e57..485a14098958 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -414,7 +414,7 @@ void fib6_select_path(const struct net *net, struct fib6_result *res,
>  		      struct flowi6 *fl6, int oif, bool have_oif_match,
>  		      const struct sk_buff *skb, int strict)
>  {
> -	struct fib6_info *sibling, *next_sibling;
> +	struct fib6_info *sibling;
>  	struct fib6_info *match = res->f6i;
>  
>  	if (!match->nh && (!match->fib6_nsiblings || have_oif_match))
> @@ -441,8 +441,8 @@ void fib6_select_path(const struct net *net, struct fib6_result *res,
>  	if (fl6->mp_hash <= atomic_read(&match->fib6_nh->fib_nh_upper_bound))
>  		goto out;
>  
> -	list_for_each_entry_safe(sibling, next_sibling, &match->fib6_siblings,
> -				 fib6_siblings) {
> +	list_for_each_entry_rcu(sibling, &match->fib6_siblings,
> +				fib6_siblings) {
>  		const struct fib6_nh *nh = sibling->fib6_nh;
>  		int nh_upper_bound;
>  


      reply	other threads:[~2024-05-15 19:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14  4:07 [PATCH] net/ipv6: Fix kernel soft lockup in fib6_select_path under high next hop churn Omid Ehtemam-Haghighi
2024-05-15 19:26 ` David Ahern [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=a21b8fb8-6615-47a2-89a4-4ba97922bd46@gmail.com \
    --to=dsahern@gmail.com \
    --cc=adrian.oliver@menlosecurity.com \
    --cc=idosch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=omid.ehtemamhaghighi@menlosecurity.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).