All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Jiri Benc <jbenc@redhat.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Eric Dumazet <edumazet@google.com>,
	George McCollister <george.mccollister@gmail.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Jay Vosburgh <j.vosburgh@gmail.com>,
	Veaceslav Falico <vfalico@gmail.com>,
	Andy Gospodarek <andy@greyhouse.net>
Subject: Re: [RFC PATCH net-next 05/13] net: bonding: hold the netdev lists lock when retrieving device statistics
Date: Wed, 9 Dec 2020 00:03:56 +0000	[thread overview]
Message-ID: <20201209000355.vv4gaj7sgi6kph27@skbuf> (raw)
In-Reply-To: <20201208155744.320d694b@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com>

On Tue, Dec 08, 2020 at 03:57:44PM -0800, Jakub Kicinski wrote:
> On Mon, 7 Dec 2020 01:00:40 +0000 Vladimir Oltean wrote:
> > - ensuring through convention that user space always takes
> >   net->netdev_lists_lock when calling dev_get_stats, and documenting
> >   that, and therefore making it unnecessary to lock in bonding.
>
> This seems like the better option to me. Makes the locking rules pretty
> clear.

It is non-obvious to me that top-level callers of dev_get_stats should
hold a lock as specific as the one protecting the lists of network
interfaces. In the vast majority of implementations of dev_get_stats,
that lock would not actually protect anything, which would lead into
just one more lock that is used for more than it should be. In my tree I
had actually already switched over to mutex_lock_nested. Nonetheless, I
am still open if you want to make the case that simplicity should prevail
over specificity. But in that case, maybe we should just keep on using
the RTNL mutex.

  reply	other threads:[~2020-12-09  0:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06 23:59 [RFC PATCH net-next 00/13] Make .ndo_get_stats64 sleepable Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 01/13] RDMA/mlx4: remove bogus dev_base_lock usage Vladimir Oltean
2020-12-08  6:43   ` Leon Romanovsky
2020-12-06 23:59 ` [RFC PATCH net-next 02/13] net: mark dev_base_lock for deprecation Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 03/13] net: introduce a mutex for the netns interface lists Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 04/13] s390/appldata_net_sum: hold the netdev lists lock when retrieving device statistics Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 05/13] net: bonding: " Vladimir Oltean
2020-12-07  1:00   ` Vladimir Oltean
2020-12-07 15:22     ` Vladimir Oltean
2020-12-08 23:57     ` Jakub Kicinski
2020-12-09  0:03       ` Vladimir Oltean [this message]
2020-12-09  0:17         ` Jakub Kicinski
2020-12-09  1:14           ` Vladimir Oltean
2020-12-09  1:28             ` Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 06/13] net_failover: " Vladimir Oltean
2020-12-07  2:22   ` kernel test robot
2020-12-06 23:59 ` [RFC PATCH net-next 07/13] parisc/led: remove trailing whitespaces Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 08/13] parisc/led: reindent the code that gathers device statistics Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 09/13] parisc/led: hold the netdev lists lock when retrieving " Vladimir Oltean
2020-12-07  6:14   ` kernel test robot
2020-12-06 23:59 ` [RFC PATCH net-next 10/13] net: procfs: " Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 11/13] net: sysfs: don't hold dev_base_lock while " Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 12/13] net: mark ndo_get_stats64 as being able to sleep Vladimir Oltean
2020-12-06 23:59 ` [RFC PATCH net-next 13/13] net: remove obsolete comments about ndo_get_stats64 context from eth drivers Vladimir Oltean

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=20201209000355.vv4gaj7sgi6kph27@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=george.mccollister@gmail.com \
    --cc=j.vosburgh@gmail.com \
    --cc=jbenc@redhat.com \
    --cc=jhs@mojatatu.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pablo@netfilter.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=stephen@networkplumber.org \
    --cc=vfalico@gmail.com \
    --cc=xiyou.wangcong@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.