All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-rc] RDMA/umem: Use dma-buf locked API to solve deadlock
@ 2023-01-30 14:25 Leon Romanovsky
  2023-01-30 14:50 ` Dmitry Osipenko
  2023-01-31 14:25 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Leon Romanovsky @ 2023-01-30 14:25 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Maor Gottlieb, Christian König, Dmitry Osipenko, linux-rdma

From: Maor Gottlieb <maorg@nvidia.com>

The cited commit moves umem to call the unlocked versions of dmabuf
unmap/map attachment, but the lock is held while calling to these
functions, hence move back to the locked versions of these APIs.

Fixes: 21c9c5c0784f ("RDMA/umem: Prepare to dynamic dma-buf locking specification")
Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/core/umem_dmabuf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/core/umem_dmabuf.c b/drivers/infiniband/core/umem_dmabuf.c
index 43b26bc12288..39357dc2d229 100644
--- a/drivers/infiniband/core/umem_dmabuf.c
+++ b/drivers/infiniband/core/umem_dmabuf.c
@@ -26,8 +26,8 @@ int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf)
 	if (umem_dmabuf->sgt)
 		goto wait_fence;
 
-	sgt = dma_buf_map_attachment_unlocked(umem_dmabuf->attach,
-					      DMA_BIDIRECTIONAL);
+	sgt = dma_buf_map_attachment(umem_dmabuf->attach,
+				     DMA_BIDIRECTIONAL);
 	if (IS_ERR(sgt))
 		return PTR_ERR(sgt);
 
@@ -103,8 +103,8 @@ void ib_umem_dmabuf_unmap_pages(struct ib_umem_dmabuf *umem_dmabuf)
 		umem_dmabuf->last_sg_trim = 0;
 	}
 
-	dma_buf_unmap_attachment_unlocked(umem_dmabuf->attach, umem_dmabuf->sgt,
-					  DMA_BIDIRECTIONAL);
+	dma_buf_unmap_attachment(umem_dmabuf->attach, umem_dmabuf->sgt,
+				 DMA_BIDIRECTIONAL);
 
 	umem_dmabuf->sgt = NULL;
 }
-- 
2.39.1


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

* Re: [PATCH rdma-rc] RDMA/umem: Use dma-buf locked API to solve deadlock
  2023-01-30 14:25 [PATCH rdma-rc] RDMA/umem: Use dma-buf locked API to solve deadlock Leon Romanovsky
@ 2023-01-30 14:50 ` Dmitry Osipenko
  2023-01-31 14:25 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Osipenko @ 2023-01-30 14:50 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe
  Cc: Maor Gottlieb, Christian König, linux-rdma

On 1/30/23 17:25, Leon Romanovsky wrote:
> From: Maor Gottlieb <maorg@nvidia.com>
> 
> The cited commit moves umem to call the unlocked versions of dmabuf
> unmap/map attachment, but the lock is held while calling to these
> functions, hence move back to the locked versions of these APIs.
> 
> Fixes: 21c9c5c0784f ("RDMA/umem: Prepare to dynamic dma-buf locking specification")
> Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/core/umem_dmabuf.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/infiniband/core/umem_dmabuf.c b/drivers/infiniband/core/umem_dmabuf.c
> index 43b26bc12288..39357dc2d229 100644
> --- a/drivers/infiniband/core/umem_dmabuf.c
> +++ b/drivers/infiniband/core/umem_dmabuf.c
> @@ -26,8 +26,8 @@ int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf)
>  	if (umem_dmabuf->sgt)
>  		goto wait_fence;
>  
> -	sgt = dma_buf_map_attachment_unlocked(umem_dmabuf->attach,
> -					      DMA_BIDIRECTIONAL);
> +	sgt = dma_buf_map_attachment(umem_dmabuf->attach,
> +				     DMA_BIDIRECTIONAL);
>  	if (IS_ERR(sgt))
>  		return PTR_ERR(sgt);
>  
> @@ -103,8 +103,8 @@ void ib_umem_dmabuf_unmap_pages(struct ib_umem_dmabuf *umem_dmabuf)
>  		umem_dmabuf->last_sg_trim = 0;
>  	}
>  
> -	dma_buf_unmap_attachment_unlocked(umem_dmabuf->attach, umem_dmabuf->sgt,
> -					  DMA_BIDIRECTIONAL);
> +	dma_buf_unmap_attachment(umem_dmabuf->attach, umem_dmabuf->sgt,
> +				 DMA_BIDIRECTIONAL);
>  
>  	umem_dmabuf->sgt = NULL;
>  }

Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

-- 
Best regards,
Dmitry


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

* Re: [PATCH rdma-rc] RDMA/umem: Use dma-buf locked API to solve deadlock
  2023-01-30 14:25 [PATCH rdma-rc] RDMA/umem: Use dma-buf locked API to solve deadlock Leon Romanovsky
  2023-01-30 14:50 ` Dmitry Osipenko
@ 2023-01-31 14:25 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2023-01-31 14:25 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Maor Gottlieb, Christian König, Dmitry Osipenko, linux-rdma

On Mon, Jan 30, 2023 at 04:25:50PM +0200, Leon Romanovsky wrote:
> From: Maor Gottlieb <maorg@nvidia.com>
> 
> The cited commit moves umem to call the unlocked versions of dmabuf
> unmap/map attachment, but the lock is held while calling to these
> functions, hence move back to the locked versions of these APIs.
> 
> Fixes: 21c9c5c0784f ("RDMA/umem: Prepare to dynamic dma-buf locking specification")
> Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> ---
>  drivers/infiniband/core/umem_dmabuf.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2023-01-31 14:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 14:25 [PATCH rdma-rc] RDMA/umem: Use dma-buf locked API to solve deadlock Leon Romanovsky
2023-01-30 14:50 ` Dmitry Osipenko
2023-01-31 14:25 ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.