All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	f.fainelli@gmail.com, vivien.didelot@gmail.com,
	xiyou.wangcong@gmail.com, ap420073@gmail.com
Subject: Re: [PATCH net] net: dsa: link interfaces with the DSA master to get rid of lockdep warnings
Date: Mon, 13 Jul 2020 20:30:49 +0300	[thread overview]
Message-ID: <20200713173049.wzo7e2rpbtfbwdxd@skbuf> (raw)
In-Reply-To: <20200713164728.GH1078057@lunn.ch>

Hi Andrew,

On Mon, Jul 13, 2020 at 06:47:28PM +0200, Andrew Lunn wrote:
> > diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> > index 743caabeaaa6..a951b2a7d79a 100644
> > --- a/net/dsa/slave.c
> > +++ b/net/dsa/slave.c
> > @@ -1994,6 +1994,13 @@ int dsa_slave_create(struct dsa_port *port)
> >  			   ret, slave_dev->name);
> >  		goto out_phy;
> >  	}
> > +	rtnl_lock();
> > +	ret = netdev_upper_dev_link(master, slave_dev, NULL);
> > +	rtnl_unlock();
> > +	if (ret) {
> > +		unregister_netdevice(slave_dev);
> > +		goto out_phy;
> > +	}
> 
> Hi Vladimir
> 
> A common pattern we see in bugs is that the driver sets up something
> critical after calling register_netdev(), not realising that that call
> can go off and really start using the interface before it returns. So
> in general, i like to have register_netdev() last, nothing after it.
> 
> Please could you move this before register_netdev().
> 
> Thanks
> 	Andrew

It doesn't work after register_netdev(). The call to
netdev_upper_dev_link() fails and no network interface gets probed. VLAN
performs registration and linkage in the same order:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/net/8021q/vlan.c#n175

So I think this part is fine.

Thanks,
-Vladimir

  reply	other threads:[~2020-07-13 17:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 16:24 [PATCH net] net: dsa: link interfaces with the DSA master to get rid of lockdep warnings Vladimir Oltean
2020-07-13 16:47 ` Andrew Lunn
2020-07-13 17:30   ` Vladimir Oltean [this message]
2020-07-13 17:33     ` Vladimir Oltean
2020-07-13 17:42       ` Vladimir Oltean
2020-07-13 18:59         ` Andrew Lunn
2020-07-14  0:48         ` David Miller
2020-07-13 18:39 ` Florian Fainelli
2020-07-16 23:06 ` Jakub Kicinski

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=20200713173049.wzo7e2rpbtfbwdxd@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@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.