Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH rdma-next] RDMA/mlx5: Annotate lock dependency in unbinding slave port
@ 2019-08-08  8:39 Leon Romanovsky
  2019-08-12 14:31 ` Doug Ledford
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2019-08-08  8:39 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe; +Cc: Leon Romanovsky, RDMA mailing list

From: Leon Romanovsky <leonro@mellanox.com>

NULL-ing notifier_call is performed under protection
of mlx5_ib_multiport_mutex lock. Such protection is
not easily spotted and better to be guarded by lockdep
annotation.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
Based on -rc commit: 23eaf3b5c1a7 ("RDMA/mlx5: Release locks during notifier unregister")
---
 drivers/infiniband/hw/mlx5/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 7933534be931..63969484421c 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -5835,6 +5835,8 @@ static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev,
 	int err;
 	int i;

+	lockdep_assert_held(&mlx5_ib_multiport_mutex);
+
 	mlx5_ib_cleanup_cong_debugfs(ibdev, port_num);

 	spin_lock(&port->mp.mpi_lock);
--
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH rdma-next] RDMA/mlx5: Annotate lock dependency in unbinding slave port
  2019-08-08  8:39 [PATCH rdma-next] RDMA/mlx5: Annotate lock dependency in unbinding slave port Leon Romanovsky
@ 2019-08-12 14:31 ` Doug Ledford
  2019-08-13 10:26   ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Ledford @ 2019-08-12 14:31 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe; +Cc: Leon Romanovsky, RDMA mailing list

[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]

On Thu, 2019-08-08 at 11:39 +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> NULL-ing notifier_call is performed under protection
> of mlx5_ib_multiport_mutex lock. Such protection is
> not easily spotted and better to be guarded by lockdep
> annotation.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
> Based on -rc commit: 23eaf3b5c1a7 ("RDMA/mlx5: Release locks during
> notifier unregister")
> ---
>  drivers/infiniband/hw/mlx5/main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c
> b/drivers/infiniband/hw/mlx5/main.c
> index 7933534be931..63969484421c 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -5835,6 +5835,8 @@ static void mlx5_ib_unbind_slave_port(struct
> mlx5_ib_dev *ibdev,
>  	int err;
>  	int i;
> 
> +	lockdep_assert_held(&mlx5_ib_multiport_mutex);
> +
>  	mlx5_ib_cleanup_cong_debugfs(ibdev, port_num);
> 
>  	spin_lock(&port->mp.mpi_lock);
> --
> 2.20.1
> 

Hi Leon,

This patch needed to catch both the unbind and the bind/init routine as
they both require the multiport mutex be held.  Can you respin please?

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH rdma-next] RDMA/mlx5: Annotate lock dependency in unbinding slave port
  2019-08-12 14:31 ` Doug Ledford
@ 2019-08-13 10:26   ` Leon Romanovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2019-08-13 10:26 UTC (permalink / raw)
  To: Doug Ledford; +Cc: Jason Gunthorpe, RDMA mailing list

On Mon, Aug 12, 2019 at 10:31:19AM -0400, Doug Ledford wrote:
> On Thu, 2019-08-08 at 11:39 +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > NULL-ing notifier_call is performed under protection
> > of mlx5_ib_multiport_mutex lock. Such protection is
> > not easily spotted and better to be guarded by lockdep
> > annotation.
> >
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> > Based on -rc commit: 23eaf3b5c1a7 ("RDMA/mlx5: Release locks during
> > notifier unregister")
> > ---
> >  drivers/infiniband/hw/mlx5/main.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/infiniband/hw/mlx5/main.c
> > b/drivers/infiniband/hw/mlx5/main.c
> > index 7933534be931..63969484421c 100644
> > --- a/drivers/infiniband/hw/mlx5/main.c
> > +++ b/drivers/infiniband/hw/mlx5/main.c
> > @@ -5835,6 +5835,8 @@ static void mlx5_ib_unbind_slave_port(struct
> > mlx5_ib_dev *ibdev,
> >  	int err;
> >  	int i;
> >
> > +	lockdep_assert_held(&mlx5_ib_multiport_mutex);
> > +
> >  	mlx5_ib_cleanup_cong_debugfs(ibdev, port_num);
> >
> >  	spin_lock(&port->mp.mpi_lock);
> > --
> > 2.20.1
> >
>
> Hi Leon,
>
> This patch needed to catch both the unbind and the bind/init routine as
> they both require the multiport mutex be held.  Can you respin please?

It has comment "5889 /* The mlx5_ib_multiport_mutex should be held when
calling this function */", why do we need lockdep?

Just kidding, sending fixed patch now.

Thanks

>
> --
> Doug Ledford <dledford@redhat.com>
>     GPG KeyID: B826A3330E572FDD
>     Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08  8:39 [PATCH rdma-next] RDMA/mlx5: Annotate lock dependency in unbinding slave port Leon Romanovsky
2019-08-12 14:31 ` Doug Ledford
2019-08-13 10:26   ` Leon Romanovsky

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org linux-rdma@archiver.kernel.org
	public-inbox-index linux-rdma


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/ public-inbox