netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, pabeni@redhat.com,
	edumazet@google.com, michael.chan@broadcom.com,
	ioana.ciornei@nxp.com, dmichail@fungible.com,
	jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com,
	tchornyi@marvell.com, tariqt@nvidia.com, saeedm@nvidia.com,
	leon@kernel.org, idosch@nvidia.com, petrm@nvidia.com,
	vladimir.oltean@nxp.com, claudiu.manoil@nxp.com,
	alexandre.belloni@bootlin.com, simon.horman@corigine.com,
	shannon.nelson@amd.com, brett.creeley@amd.com
Subject: Re: [patch net-next 0/8] devlink: make sure devlink port registers/unregisters only for registered instance
Date: Mon, 5 Dec 2022 17:08:26 -0800	[thread overview]
Message-ID: <20221205170826.17c78e90@kernel.org> (raw)
In-Reply-To: <20221205152257.454610-1-jiri@resnulli.us>

On Mon,  5 Dec 2022 16:22:49 +0100 Jiri Pirko wrote:
> Currently, the devlink_register() is called as the last thing during
> driver init phase. For devlink objects, this is fine as the
> notifications of objects creations are withheld to be send only after
> devlink instance is registered. Until devlink is registered it is not
> visible to userspace.
> 
> But if a  netdev is registered before, user gets a notification with
> a link to devlink, which is not visible to the user yet.
> This is the event order user sees:
>  * new netdev event over RT netlink
>  * new devlink event over devlink netlink
>  * new devlink_port event over devlink netlink
> 
> Also, this is not consistent with devlink port split or devlink reload
> flows, where user gets notifications in following order:
>  * new devlink event over devlink netlink
> and then during port split or reload operation:
>  * new devlink_port event over devlink netlink
>  * new netdev event over RT netlink
> 
> In this case, devlink port and related netdev are registered on already
> registered devlink instance.
> 
> Purpose of this patchset is to fix the drivers init flow so devlink port
> gets registered only after devlink instance is registered.

I didn't reply because I don't have much to add beyond what 
I've already said too many times. I prefer to move to my
initial full refcounting / full locking design. I haven't posted 
any patches because I figured it's too low priority and too risky
to be doing right before the merge window.

I agree that reordering is a good idea but not as a fix, and hopefully
without conditional locking in the drivers:

+		if (!reload)
+			devl_lock(devlink);
+		err = mlxsw_driver->ports_init(mlxsw_core);
+		if (!reload)
+			devl_unlock(devlink);

  parent reply	other threads:[~2022-12-06  1:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 15:22 [patch net-next 0/8] devlink: make sure devlink port registers/unregisters only for registered instance Jiri Pirko
2022-12-05 15:22 ` [patch net-next 1/8] devlink: call devlink_port_register/unregister() on " Jiri Pirko
2022-12-05 23:55   ` Shannon Nelson
2022-12-06  7:41     ` Jiri Pirko
2022-12-06  7:56       ` Leon Romanovsky
2022-12-06 17:35       ` Shannon Nelson
2022-12-07 13:27         ` Jiri Pirko
2022-12-07 19:45           ` Shannon Nelson
2022-12-05 15:22 ` [patch net-next 2/8] netdevsim: call devl_port_register/unregister() " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 3/8] mlxsw: " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 4/8] nfp: " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 5/8] mlx4: " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 6/8] mlx5: " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 7/8] devlink: assert if devl_port_register/unregister() is called on unregistered devlink instance Jiri Pirko
2022-12-05 15:22 ` [patch net-next 8/8] devlink: remove port notifications from devlink_register/unregister() Jiri Pirko
2022-12-06  1:08 ` Jakub Kicinski [this message]
2022-12-06  7:44   ` [patch net-next 0/8] devlink: make sure devlink port registers/unregisters only for registered instance Jiri Pirko
2022-12-06 20:12     ` Jakub Kicinski
2022-12-07 13:28       ` Jiri Pirko

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=20221205170826.17c78e90@kernel.org \
    --to=kuba@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=brett.creeley@amd.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=dmichail@fungible.com \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jiri@resnulli.us \
    --cc=leon@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=shannon.nelson@amd.com \
    --cc=simon.horman@corigine.com \
    --cc=tariqt@nvidia.com \
    --cc=tchornyi@marvell.com \
    --cc=vladimir.oltean@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).