Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp609394pxb; Wed, 29 Sep 2021 06:11:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXyBxcMJzwlZt6yca7l+GMN5lAGTWt5igGpDIO5fgyKd1pV26B7NCe3AErCfGt+RnDsINl X-Received: by 2002:a62:1446:0:b0:44b:dfb8:e182 with SMTP id 67-20020a621446000000b0044bdfb8e182mr1403422pfu.58.1632921111457; Wed, 29 Sep 2021 06:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921111; cv=none; d=google.com; s=arc-20160816; b=WAUJmqCQ8JmOkDjH6gxoFDe55YvbLeS4WYBKZucZ7Ce9vcpSbI4LAH6uHUa7lZ5p/4 R0b1Q6czTZ5CK/Nc2WF18ow+R8Z6xdNhGpRGE6Ta2bKG8YUdSh2ReBpPRLws2dtjk136 ael3IGoZY3M+FhF1S+bYaWHPNyJwWddrolKOGRtqdoAOmcJqCwBp8kagsBwImXPnMG7f NqLSPCjgiu5zAf0CNrqi/qdanUjuGgpC7/bttXNseYnfYD73VOeMtwHSxjl7C/rhBII1 MF60MbdiS+LvvaPJ6VIixT9Pyz1QbIZbupN2ZRc5m0rLtNnztdmi79aOVvpOMDM4zpq/ 0VbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=o70ygENomwS2uH8WmDkb/fZ+VsL7CPf49CRLcoMl0hw=; b=AVcifCek2Fbl7+TIqc/pIBG6Hrp+c2f5+WWDXOwbXlKNp8IC4XJ9No49tTCmev7td6 ccxtqDUD+uBgx7huZqGk7oHeVcl62WkZYwD1gGLijoSE8AZhvWte3SJw9oULPPgl2Djt 2rzZXVqXe2piTR8pBPCAf8/fwGP2R3INzVVR7Ff6GILqwk+p+O1m9MitjOG5ekijeuYk V0NLYqcH+ndpy4RbLUXLj6H38YQcvacjVK9Vx1EhuvHCHvw/A2vewBwLduJYEZ70dW6j TZVK/K65iKI0IVvzFMVGDK+6eAL8ub4wOSUqy0jrMGyraKEODXOF+GJlEaJrSZsLHFT+ nlsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cCEGI93a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si2778800plt.111.2021.09.29.06.11.30; Wed, 29 Sep 2021 06:11:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cCEGI93a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344044AbhI2NJe (ORCPT + 99 others); Wed, 29 Sep 2021 09:09:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:34634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242801AbhI2NJd (ORCPT ); Wed, 29 Sep 2021 09:09:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B56C613DA; Wed, 29 Sep 2021 13:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632920872; bh=Yukjau1sHLA6B/N3xjvNRV9Olu/CU/SlHx+B5dO3Emw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cCEGI93aXv71iUXZzEJTr2TRq+w3ofeLRCnVE3mfUAwTgmo43LOO/x8xfal4Yn1Ze 5X71y4uQ8YRh7OnS2bZh3zt5QGH/d+GE6zboUgNaYqlOLi52ms5UVyyxV39ka0MEOc Czm7DZiGEiitUVSNqCGOAnAaUcGcngUKxn7fUwdUbP4McZrhBmNWkEdjvdPSpoJgij Op8x6hXOiS0e+qrOEdpoSZZBHRkELZgQJCbCuJYraJ3HdQU2dXmtZGQZ7z6+pf+E9p 00gA9nJxmMWYATc3ehdXmsvfP3HTePMl+KEh7MA/OvrjrQdLZyAiE5oQqMPds3v/pB D+ilhSmpvuSsQ== Date: Wed, 29 Sep 2021 16:07:49 +0300 From: Leon Romanovsky To: Vladimir Oltean Cc: "David S . Miller" , Jakub Kicinski , Alexandre Belloni , Andrew Lunn , Ariel Elior , Bin Luo , Claudiu Manoil , Coiby Xu , Derek Chickles , "drivers@pensando.io" , Felix Manlunas , Florian Fainelli , Geetha sowjanya , Greg Kroah-Hartman , "GR-everest-linux-l2@marvell.com" , "GR-Linux-NIC-Dev@marvell.com" , hariprasad , Ido Schimmel , Intel Corporation , "intel-wired-lan@lists.osuosl.org" , Ioana Ciornei , Jerin Jacob , Jesse Brandeburg , Jiri Pirko , Jonathan Lemon , Linu Cherian , "linux-kernel@vger.kernel.org" , "linux-omap@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "linux-staging@lists.linux.dev" , Loic Poulain , Manish Chopra , M Chetan Kumar , Michael Chan , Michael Guralnik , "netdev@vger.kernel.org" , "oss-drivers@corigine.com" , Richard Cochran , Saeed Mahameed , Satanand Burla , Sergey Ryazanov , Shannon Nelson , Simon Horman , Subbaraya Sundeep , Sunil Goutham , Taras Chornyi , Tariq Toukan , Tony Nguyen , "UNGLinuxDriver@microchip.com" , Vadym Kochan , Vivien Didelot Subject: Re: [PATCH net-next v1 21/21] net: dsa: Move devlink registration to be last devlink command Message-ID: References: <66dd7979b44ac307711c382054f428f9287666a8.1632565508.git.leonro@nvidia.com> <20210929130226.j53fcztm6utpt3tu@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210929130226.j53fcztm6utpt3tu@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > > This change prevents from users to access device before devlink > > is fully configured. > > > > Signed-off-by: Leon Romanovsky > > --- > > 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