[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YVRlJagqFInXCgGZ@unreal>
Date: Wed, 29 Sep 2021 16:07:49 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Vladimir Oltean <vladimir.oltean@....com>
Cc: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Andrew Lunn <andrew@...n.ch>, Ariel Elior <aelior@...vell.com>,
Bin Luo <luobin9@...wei.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Coiby Xu <coiby.xu@...il.com>,
Derek Chickles <dchickles@...vell.com>,
"drivers@...sando.io" <drivers@...sando.io>,
Felix Manlunas <fmanlunas@...vell.com>,
Florian Fainelli <f.fainelli@...il.com>,
Geetha sowjanya <gakula@...vell.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"GR-everest-linux-l2@...vell.com" <GR-everest-linux-l2@...vell.com>,
"GR-Linux-NIC-Dev@...vell.com" <GR-Linux-NIC-Dev@...vell.com>,
hariprasad <hkelam@...vell.com>,
Ido Schimmel <idosch@...dia.com>,
Intel Corporation <linuxwwan@...el.com>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
Ioana Ciornei <ioana.ciornei@....com>,
Jerin Jacob <jerinj@...vell.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Jiri Pirko <jiri@...dia.com>,
Jonathan Lemon <jonathan.lemon@...il.com>,
Linu Cherian <lcherian@...vell.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
Loic Poulain <loic.poulain@...aro.org>,
Manish Chopra <manishc@...vell.com>,
M Chetan Kumar <m.chetan.kumar@...el.com>,
Michael Chan <michael.chan@...adcom.com>,
Michael Guralnik <michaelgur@...lanox.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"oss-drivers@...igine.com" <oss-drivers@...igine.com>,
Richard Cochran <richardcochran@...il.com>,
Saeed Mahameed <saeedm@...dia.com>,
Satanand Burla <sburla@...vell.com>,
Sergey Ryazanov <ryazanov.s.a@...il.com>,
Shannon Nelson <snelson@...sando.io>,
Simon Horman <simon.horman@...igine.com>,
Subbaraya Sundeep <sbhatta@...vell.com>,
Sunil Goutham <sgoutham@...vell.com>,
Taras Chornyi <tchornyi@...vell.com>,
Tariq Toukan <tariqt@...dia.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
Vadym Kochan <vkochan@...vell.com>,
Vivien Didelot <vivien.didelot@...il.com>
Subject: Re: [PATCH net-next v1 21/21] net: dsa: Move devlink registration to
be last devlink command
On Wed, Sep 29, 2021 at 01:02:27PM +0000, Vladimir Oltean wrote:
> Hi Leon,
>
> On Sat, Sep 25, 2021 at 02:23:01PM +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@...dia.com>
> >
> > This change prevents from users to access device before devlink
> > is fully configured.
> >
> > Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> > ---
> > net/dsa/dsa2.c | 10 ++++------
> > 1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
> > index a020339e1973..8ca6a1170c9d 100644
> > --- a/net/dsa/dsa2.c
> > +++ b/net/dsa/dsa2.c
> > @@ -848,7 +848,6 @@ static int dsa_switch_setup(struct dsa_switch *ds)
> > dl_priv = devlink_priv(ds->devlink);
> > dl_priv->ds = ds;
> >
> > - devlink_register(ds->devlink);
> > /* Setup devlink port instances now, so that the switch
> > * setup() can register regions etc, against the ports
> > */
> > @@ -874,8 +873,6 @@ static int dsa_switch_setup(struct dsa_switch *ds)
> > if (err)
> > goto teardown;
> >
> > - devlink_params_publish(ds->devlink);
> > -
> > if (!ds->slave_mii_bus && ds->ops->phy_read) {
> > ds->slave_mii_bus = mdiobus_alloc();
> > if (!ds->slave_mii_bus) {
> > @@ -891,7 +888,7 @@ static int dsa_switch_setup(struct dsa_switch *ds)
> > }
> >
> > ds->setup = true;
> > -
> > + devlink_register(ds->devlink);
> > return 0;
> >
> > free_slave_mii_bus:
> > @@ -906,7 +903,6 @@ static int dsa_switch_setup(struct dsa_switch *ds)
> > list_for_each_entry(dp, &ds->dst->ports, list)
> > if (dp->ds == ds)
> > dsa_port_devlink_teardown(dp);
> > - devlink_unregister(ds->devlink);
> > devlink_free(ds->devlink);
> > ds->devlink = NULL;
> > return err;
> > @@ -919,6 +915,9 @@ static void dsa_switch_teardown(struct dsa_switch *ds)
> > if (!ds->setup)
> > return;
> >
> > + if (ds->devlink)
> > + devlink_unregister(ds->devlink);
> > +
> > if (ds->slave_mii_bus && ds->ops->phy_read) {
> > mdiobus_unregister(ds->slave_mii_bus);
> > mdiobus_free(ds->slave_mii_bus);
> > @@ -934,7 +933,6 @@ static void dsa_switch_teardown(struct dsa_switch *ds)
> > list_for_each_entry(dp, &ds->dst->ports, list)
> > if (dp->ds == ds)
> > dsa_port_devlink_teardown(dp);
> > - devlink_unregister(ds->devlink);
> > devlink_free(ds->devlink);
> > ds->devlink = NULL;
> > }
> > --
> > 2.31.1
> >
>
> Sorry, I did not have time to review/test this change earlier.
> I now see this WARN_ON being triggered when I boot a board:
Sorry about that, it was missed in one of my rebases.
The fix was posted here.
https://lore.kernel.org/all/2ed1159291f2a589b013914f2b60d8172fc525c1.1632916329.git.leonro@nvidia.com
Thanks
Powered by blists - more mailing lists