[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c3855595-d8b4-4b4b-b1fb-0efa44d064b0@kernel.org>
Date: Tue, 29 Apr 2025 09:22:46 -0600
From: David Ahern <dsahern@...nel.org>
To: Andrea Mayer <andrea.mayer@...roma2.it>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>, Kuniyuki Iwashima <kuniyu@...zon.com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org, bpf@...r.kernel.org
Cc: Stefano Salsano <stefano.salsano@...roma2.it>,
Paolo Lungaroni <paolo.lungaroni@...roma2.it>,
Ahmed Abdelsalam <ahabdels.dev@...il.com>
Subject: Re: [net-next] ipv6: sr: switch to GFP_ATOMIC flag to allocate memory
during seg6local LWT setup
On 4/29/25 6:24 AM, Andrea Mayer wrote:
> Recent updates to the locking mechanism that protects IPv6 routing tables
> [1] have affected the SRv6 networking subsystem. Such changes cause
> problems with some SRv6 Endpoints behaviors, like End.B6.Encaps and also
> impact SRv6 counters.
>
> Starting from commit 169fd62799e8 ("ipv6: Get rid of RTNL for SIOCADDRT and
> RTM_NEWROUTE."), the inet6_rtm_newroute() function no longer needs to
> acquire the RTNL lock for creating and configuring IPv6 routes and set up
> lwtunnels.
> The RTNL lock can be avoided because the ip6_route_add() function
> finishes setting up a new route in a section protected by RCU.
> This makes sure that no dev/nexthops can disappear during the operation.
> Because of this, the steps for setting up lwtunnels - i.e., calling
> lwtunnel_build_state() - are now done in a RCU lock section and not
> under the RTNL lock anymore.
>
> However, creating and configuring a lwtunnel instance in an
> RCU-protected section can be problematic when that tunnel needs to
> allocate memory using the GFP_KERNEL flag.
> For example, the following trace shows what happens when an SRv6
> End.B6.Encaps behavior is instantiated after commit 169fd62799e8 ("ipv6:
> Get rid of RTNL for SIOCADDRT and RTM_NEWROUTE."):
>
...
>
> To solve this issue, we replace the GFP_KERNEL flag with the GFP_ATOMIC
> one in those SRv6 Endpoints that need to allocate memory during the
> setup phase. This change makes sure that memory allocations are handled
> in a way that works with RCU critical sections.
>
> [1] - https://lore.kernel.org/all/20250418000443.43734-1-kuniyu@amazon.com/
>
> Fixes: 169fd62799e8 ("ipv6: Get rid of RTNL for SIOCADDRT and RTM_NEWROUTE.")
> Signed-off-by: Andrea Mayer <andrea.mayer@...roma2.it>
> ---
> net/ipv6/seg6_local.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
Reviewed-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists