public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Eric Dumazet <edumazet@google.com>, Ido Schimmel <idosch@nvidia.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, andrew+netdev@lunn.ch, petrm@nvidia.com,
	lirongqing@baidu.com
Subject: Re: [PATCH net-next 3/3] vrf: Remove unnecessary synchronize_rcu() invocations
Date: Wed, 25 Mar 2026 08:17:30 -0600	[thread overview]
Message-ID: <1ea4c187-9c1f-4e15-b472-07a82abd3260@kernel.org> (raw)
In-Reply-To: <CANn89iJ9hD3vBiViEz886sVwuqQVbaocnE0UJHZMhchFHKiM-w@mail.gmail.com>

On 3/24/26 2:39 PM, Eric Dumazet wrote:
> On Tue, Mar 24, 2026 at 8:56 AM Ido Schimmel <idosch@nvidia.com> wrote:
>>
>> vrf_rtable_release() and vrf_rt6_release() are called as part of the VRF
>> device's ndo_uninit() callback. As such, an RCU grace period passes
>> between the removal of the VRF slaves and the closing of the VRF device
>> until these functions are invoked.
>>
>> Therefore, it should not be possible for any concurrent RCU readers to
>> try and acquire a reference on the dst entry while we are potentially
>> releasing the last reference via dst_release().
>>
>> Given the above, the synchronize_rcu() invocations in these functions
>> seem unnecessary and only add unnecessary delay when deleting VRF
>> devices. Remove them.
>>
>> Reviewed-by: Petr Machata <petrm@nvidia.com>
>> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
>> ---
>>  drivers/net/vrf.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
>> index bfc9ea91ac20..75edb8eba87f 100644
>> --- a/drivers/net/vrf.c
>> +++ b/drivers/net/vrf.c
>> @@ -753,7 +753,6 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf)
>>         struct rt6_info *rt6 = rtnl_dereference(vrf->rt6);
>>
>>         RCU_INIT_POINTER(vrf->rt6, NULL);
> 
> We could argue that the vrf->rt6 clearing is not needed,
> or should be done before the RCU grace period mentioned in the
> changelog started ?
> 

AIUI Ido's point is that the synchronize_net() in
unregister_netdevice_many_notify() occurs before the ndo_uninit call
making the synchronize_rcu here unnecessary. There is also a second
synchronize_net after it.

I get your point about skipping the clearing the poiniters.

  reply	other threads:[~2026-03-25 14:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 15:55 [PATCH net-next 0/3] vrf: A few cleanups Ido Schimmel
2026-03-24 15:55 ` [PATCH net-next 1/3] vrf: Remove unnecessary NULL check Ido Schimmel
2026-03-24 19:06   ` David Ahern
2026-03-24 15:55 ` [PATCH net-next 2/3] vrf: Use dst_dev_put() instead of using loopback device Ido Schimmel
2026-03-24 19:07   ` David Ahern
2026-03-24 15:55 ` [PATCH net-next 3/3] vrf: Remove unnecessary synchronize_rcu() invocations Ido Schimmel
2026-03-24 19:09   ` David Ahern
2026-03-24 20:39   ` Eric Dumazet
2026-03-25 14:17     ` David Ahern [this message]
2026-03-25 14:42       ` Ido Schimmel
2026-03-25 14:57         ` Eric Dumazet
2026-03-25 20:11           ` Ido Schimmel
2026-03-25 22:35             ` David Ahern

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=1ea4c187-9c1f-4e15-b472-07a82abd3260@kernel.org \
    --to=dsahern@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.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