All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Jiri Benc <jbenc@redhat.com>, Or Gerlitz <ogerlitz@mellanox.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>, Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: Correct usage of dev_base_lock in 2020
Date: Mon, 30 Nov 2020 23:11:58 +0200	[thread overview]
Message-ID: <20201130211158.37ay2uvdwcnegw45@skbuf> (raw)
In-Reply-To: <CANn89i+D+7XyYi=x2UxCrMM72GeP3u5MB0-7xruOZJGrERJ5vQ@mail.gmail.com>

On Mon, Nov 30, 2020 at 10:00:16PM +0100, Eric Dumazet wrote:
> On Mon, Nov 30, 2020 at 9:50 PM Vladimir Oltean <olteanv@gmail.com> wrote:
> >
> > On Mon, Nov 30, 2020 at 09:43:01PM +0100, Eric Dumazet wrote:
> > > Understood, but really dev_base_lock can only be removed _after_ we
> > > convert all usages to something else (mutex based, and preferably not
> > > the global RTNL)
> >
> > Sure.
> > A large part of getting rid of dev_base_lock seems to be just:
> > - deleting the bogus usage from mlx4 infiniband and friends
> > - converting procfs, sysfs and friends to netdev_lists_mutex
> > - renaming whatever is left into something related to the RFC 2863
> >   operstate.
> >
> > > Focusing on dev_base_lock seems a distraction really.
> >
> > Maybe.
> > But it's going to be awkward to explain in words what the locking rules
> > are, when the read side can take optionally the dev_base_lock, RCU, or
> > netdev_lists_lock, and the write side can take optionally the dev_base_lock,
> > RTNL, or netdev_lists_lock. Not to mention that anybody grepping for
> > dev_base_lock will see the current usage and not make a lot out of it.
> >
> > I'm not really sure how to order this rework to be honest.
>
> We can not have a mix of RCU /rwlock/mutex. It must be one, because of
> bonding/teaming.
>
> So all existing uses of rwlock / RCU need to be removed.
>
> This is probably not trivial.

Now, "it's going to look nasty" is one thing, whereas "it won't work" is
completely different. I think it would work though, so could you expand
on why you're saying we can't have the mix? dev_change_name(),
list_netdevice() and unlist_netdevice() just need to take one more layer
of locking. The new netdev_lists_mutex would serve as a temporary
alternative to the RTNL mutex. Then we could gradually replace more and
more of the RTNL mutex with netdev_lists_mutex. The bonding driver can
certainly use the netdev_lists_mutex. It guarantees protection against
the three functions mentioned above, and it is sleepable, and it is not
the RTNL mutex. So can procfs and sysfs. Am I missing something?

> Perhaps you could add a temporary ndo_get_sleepable_stats64() so that
> drivers can be converted one at a time.

Yeah, been there, Jakub doesn't like it.

  reply	other threads:[~2020-11-30 21:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201129182435.jgqfjbekqmmtaief@skbuf>
2020-11-29 20:58 ` Correct usage of dev_base_lock in 2020 Vladimir Oltean
2020-11-30  5:12   ` Stephen Hemminger
2020-11-30 10:41     ` Eric Dumazet
2020-11-30 18:14       ` Jakub Kicinski
2020-11-30 18:30         ` Eric Dumazet
2020-11-30 18:48         ` Vladimir Oltean
2020-11-30 19:00           ` Eric Dumazet
2020-11-30 19:03             ` Vladimir Oltean
2020-11-30 19:22               ` Eric Dumazet
2020-11-30 19:32                 ` Vladimir Oltean
2020-11-30 21:41                   ` Florian Fainelli
2020-11-30 19:46                 ` Vladimir Oltean
2020-11-30 20:18                   ` Eric Dumazet
2020-11-30 20:21                   ` Stephen Hemminger
2020-11-30 20:26                     ` Vladimir Oltean
2020-11-30 20:29                       ` Eric Dumazet
2020-11-30 20:36                         ` Vladimir Oltean
2020-11-30 20:43                           ` Eric Dumazet
2020-11-30 20:50                             ` Vladimir Oltean
2020-11-30 21:00                               ` Eric Dumazet
2020-11-30 21:11                                 ` Vladimir Oltean [this message]
2020-11-30 21:46                                   ` Eric Dumazet
2020-11-30 21:53                                     ` Vladimir Oltean
2020-11-30 22:20                                       ` Eric Dumazet
2020-11-30 22:41                                         ` Vladimir Oltean
2020-12-01 14:42           ` Pablo Neira Ayuso
2020-12-01 18:58             ` Vladimir Oltean
2020-12-10  4:32           ` [PATCH] net: bonding: retrieve device statistics under RTNL, not RCU kernel test robot
2020-12-10  4:32             ` kernel test robot

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=20201130211158.37ay2uvdwcnegw45@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=jbenc@redhat.com \
    --cc=jhs@mojatatu.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=stephen@networkplumber.org \
    --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.