netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Andrea Mayer <andrea.mayer@uniroma2.it>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Kuniyuki Iwashima <kuniyu@amazon.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org
Cc: Stefano Salsano <stefano.salsano@uniroma2.it>,
	Paolo Lungaroni <paolo.lungaroni@uniroma2.it>,
	Ahmed Abdelsalam <ahabdels.dev@gmail.com>
Subject: Re: [net-next] ipv6: sr: switch to GFP_ATOMIC flag to allocate memory during seg6local LWT setup
Date: Tue, 29 Apr 2025 09:22:46 -0600	[thread overview]
Message-ID: <c3855595-d8b4-4b4b-b1fb-0efa44d064b0@kernel.org> (raw)
In-Reply-To: <20250429132453.31605-1-andrea.mayer@uniroma2.it>

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@uniroma2.it>
> ---
>  net/ipv6/seg6_local.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>


  reply	other threads:[~2025-04-29 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 13:24 [net-next] ipv6: sr: switch to GFP_ATOMIC flag to allocate memory during seg6local LWT setup Andrea Mayer
2025-04-29 15:22 ` David Ahern [this message]
2025-05-02  1:10 ` patchwork-bot+netdevbpf

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=c3855595-d8b4-4b4b-b1fb-0efa44d064b0@kernel.org \
    --to=dsahern@kernel.org \
    --cc=ahabdels.dev@gmail.com \
    --cc=andrea.mayer@uniroma2.it \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paolo.lungaroni@uniroma2.it \
    --cc=stefano.salsano@uniroma2.it \
    /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 NNTP newsgroup(s).