netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: eric.dumazet@gmail.com
Cc: davem@davemloft.net, netdev@vger.kernel.org, kernel-team@fb.com,
	Jakub Kicinski <kuba@kernel.org>
Subject: [RFC -next 0/3] Re: [PATCH net 1/2] net: disable netpoll on fresh napis
Date: Thu, 27 Aug 2020 15:32:47 -0700	[thread overview]
Message-ID: <20200827223250.2045503-1-kuba@kernel.org> (raw)
In-Reply-To: <20200827104753.29d836bb@kicinski-fedora-PC1C0HJN>

On Thu, 27 Aug 2020 10:47:53 -0700 Jakub Kicinski wrote:
> > Oh, I really thought list_for_each_entry_rcu() was only checking standard rcu.
> > 
> > I might have been confused because we do have hlist_for_each_entry_rcu_bh() helper.
> > 
> > Anyway, when looking at the patch I was not at ease because we do not have proper
> > rcu grace period when a napi is removed from dev->napi_list. A driver might
> > free the napi struct right after calling netif_napi_del()  
> 
> Ugh, you're right. I didn't look closely enough at netif_napi_del():
> 
> 	if (napi_hash_del(napi))
> 		synchronize_net();
> 	list_del_init(&napi->dev_list);
> 
> Looks like I can reorder these.. and perhaps make all dev->napi_list
> accesses RCU, for netpoll?

So I had a look and looks like some reshuffling may be required
to get out of this pickle. The objective is for drivers to observe
RCU grace period after netif_napi_del() not just napi_hash_del().

Sending as RFC because IDK if the churn vs improvement ratio
is acceptable here.

Jakub Kicinski (3):
  net: remove napi_hash_del() from driver-facing API
  net: manage napi add/del idempotence explicitly
  net: make sure napi_list is safe for RCU traversal

 .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.h   |  8 ++---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c     |  5 ++-
 drivers/net/ethernet/cisco/enic/enic_main.c   | 12 ++++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c  |  4 +--
 .../net/ethernet/myricom/myri10ge/myri10ge.c  |  5 ++-
 drivers/net/veth.c                            |  3 +-
 drivers/net/virtio_net.c                      |  7 ++--
 include/linux/netdevice.h                     | 36 +++++++++----------
 net/core/dev.c                                | 32 ++++++++---------
 net/core/netpoll.c                            |  2 +-
 10 files changed, 55 insertions(+), 59 deletions(-)

-- 
2.26.2


  reply	other threads:[~2020-08-27 22:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 19:40 [PATCH net 0/2] net: fix netpoll crash with bnxt Jakub Kicinski
2020-08-26 19:40 ` [PATCH net 1/2] net: disable netpoll on fresh napis Jakub Kicinski
2020-08-27  7:25   ` Eric Dumazet
2020-08-27 15:10     ` Jakub Kicinski
2020-08-27 15:43       ` Eric Dumazet
2020-08-27 17:47         ` Jakub Kicinski
2020-08-27 22:32           ` Jakub Kicinski [this message]
2020-08-27 22:32             ` [RFC -next 1/3] net: remove napi_hash_del() from driver-facing API Jakub Kicinski
2020-08-27 22:32             ` [RFC -next 2/3] net: manage napi add/del idempotence explicitly Jakub Kicinski
2020-08-27 22:32             ` [RFC -next 3/3] net: make sure napi_list is safe for RCU traversal Jakub Kicinski
2020-08-26 19:40 ` [PATCH net 2/2] bnxt: don't enable NAPI until rings are ready Jakub Kicinski
2020-08-26 20:23   ` Michael Chan
2020-08-26 23:17 ` [PATCH net 0/2] net: fix netpoll crash with bnxt David Miller

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=20200827223250.2045503-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /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).