public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next] netpoll: remove netpoll_srcu
Date: Thu, 5 Sep 2024 02:27:40 -0700	[thread overview]
Message-ID: <20240905-witty-naughty-kakapo-7eae8b@devvm32600> (raw)
In-Reply-To: <20240905084909.2082486-1-edumazet@google.com>

Hello Eric,

On Thu, Sep 05, 2024 at 08:49:09AM +0000, Eric Dumazet wrote:
> netpoll_srcu is currently used from netpoll_poll_disable() and
> __netpoll_cleanup()
> 
> Both functions run under RTNL, using netpoll_srcu adds confusion
> and no additional protection.

Thanks for fixing it. I have never understood that SRCU in netpoll.

Reading this code now again, I have the impression that netpoll_srcu was
created to be able to dereference ->npinfo using an RCU primitive.

> Moreover the synchronize_srcu() call in __netpoll_cleanup() is
> performed before clearing np->dev->npinfo, which violates RCU rules.

I think the goal was to make sure that all the readers are not in the
critical section anymore, and wait for them. But it is unclear why it is
mixing srcu_read_lock() and rcu_read_lock() together.

Anyway, thanks for solving this.

> After this patch, netpoll_poll_disable() and netpoll_poll_enable()
> simply use rtnl_dereference().
> 
> This saves a big chunk of memory (more than 192KB on platforms
> with 512 cpus)
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Breno Leitao <leitao@debian.org>

Reviewed-by: Breno Leitao <leitao@debian.org>

I've double checked that netpoll_poll_disable() and
netpoll_poll_enable() is always called with rtnl held, so, the change is
safe.

  reply	other threads:[~2024-09-05  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05  8:49 [PATCH net-next] netpoll: remove netpoll_srcu Eric Dumazet
2024-09-05  9:27 ` Breno Leitao [this message]
2024-09-07  1:30 ` 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=20240905-witty-naughty-kakapo-7eae8b@devvm32600 \
    --to=leitao@debian.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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