linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Parav Pandit <parav@nvidia.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>,
	Doug Ledford <dledford@redhat.com>,
	Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@mellanox.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	Michael Guralnik <michaelgur@mellanox.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: RE: [PATCH rdma-rc] RDMA/mlx5: Fix devlink deadlock on net namespace deletion
Date: Mon, 19 Oct 2020 19:26:36 +0000	[thread overview]
Message-ID: <BY5PR12MB43223A907782D48862D82246DC1E0@BY5PR12MB4322.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20201019190100.GA6219@nvidia.com>



> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Tuesday, October 20, 2020 12:31 AM
> 
> On Mon, Oct 19, 2020 at 01:23:23PM +0000, Parav Pandit wrote:
> > > > -	err = register_netdevice_notifier(&dev->port[port_num].roce.nb);
> > > > +	err = register_netdevice_notifier_net(mlx5_core_net(dev->mdev),
> > > > +					      &dev->port[port_num].roce.nb);
> > >
> > > This looks racy, what lock needs to be held to keep *mlx5_core_net()
> stable?
> >
> > mlx5_core_net() cannot be accessed outside of mlx5 driver's load, unload,
> reload path.
> >
> > When this is getting executed, devlink cannot be executing reload.
> > This is guarded by devlink_reload_enable/disable calls done by mlx5 core.
> 
> A comment that devlink_reload_enable/disable() must be held would be
> helpful
> 
Yes. will add.

> > >
> > > >  	if (err) {
> > > >  		dev->port[port_num].roce.nb.notifier_call = NULL;
> > > >  		return err;
> > > > @@ -3335,7 +3336,8 @@ static int mlx5_add_netdev_notifier(struct
> > > >mlx5_ib_dev *dev, u8 port_num)  static void
> > > >mlx5_remove_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
> {
> > > >  	if (dev->port[port_num].roce.nb.notifier_call) {
> > > > -		unregister_netdevice_notifier(&dev-
> > > >port[port_num].roce.nb);
> > > > +		unregister_netdevice_notifier_net(mlx5_core_net(dev-
> > > >mdev),
> > > > +						  &dev-
> > > >port[port_num].roce.nb);
> > >
> > > This seems dangerous too, what if the mlx5_core_net changed before
> > > we get here?
> >
> > When I inspected driver, code, I am not aware of any code flow where
> > this can change before reaching here, because registration and
> > unregistration is done only in driver load, unload and reload path.
> > Reload can happen only after devlink_reload_enable() is done.
> 
> But we enable reload right after init_one
> 
> > > What are the rules for when devlink_net() changes?
> > >
> > devlink_net() changes only after unload() callback is completed in driver.
> 
> You mean mlx5_devlink_reload_down ?
> 
Right.
> That seems OK then
Ok. will work with Leon to add the comment.
> 
> Jason

  reply	other threads:[~2020-10-19 19:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19  5:27 [PATCH rdma-rc] RDMA/mlx5: Fix devlink deadlock on net namespace deletion Leon Romanovsky
2020-10-19 13:07 ` Jason Gunthorpe
2020-10-19 13:23   ` Parav Pandit
2020-10-19 19:01     ` Jason Gunthorpe
2020-10-19 19:26       ` Parav Pandit [this message]
2020-10-20 11:41         ` Parav Pandit
2020-10-26 13:38 ` Parav Pandit
2020-10-26 13:47   ` Parav Pandit
2020-10-26 13:43 ` [PATCH rdma-rc RESEND v1] " Parav Pandit
2020-10-26 22:25   ` Jason Gunthorpe

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=BY5PR12MB43223A907782D48862D82246DC1E0@BY5PR12MB4322.namprd12.prod.outlook.com \
    --to=parav@nvidia.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=jiri@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michaelgur@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.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).