mbox series

[for-next,0/3] EFA dmabuf memory regions

Message ID 20211012120903.96933-1-galpress@amazon.com (mailing list archive)
Headers show
Series EFA dmabuf memory regions | expand

Message

Gal Pressman Oct. 12, 2021, 12:09 p.m. UTC
Hey all,

This is a followup to my previous RFCs [1][2], which now adds a new api
to the RDMA subsystem that allows drivers to get a pinned dmabuf memory
region without requiring an implementation of the move_notify callback.
The new api makes use of the dynamic attachment api implemented in the
RDMA subsystem, but calls dma_buf_pin() in order to make sure that the
callback will not be called, as suggested by Christian.

As explained in the previous RFC, move_notify requires the RDMA device
to support on-demand-paging (ODP) which is not common on most devices
(only supported by mlx5).

While the dynamic requirement makes sense for certain GPUs, some devices
(such as habanalabs) have device memory that is always "pinned" and do
not need/use the move_notify operation.

Patch #1 changes the dmabuf documentation to make it clear that pinning
does not necessarily mean the memory must be moved to system memory, it
is up to the exporter to decide.
Patch #2 adds the RDMA api that allows drivers to get pinned dmabuf
memory regions.
Patch #3 adds the EFA implementation of the dmabuf importer.

The motivation of this submission is to use habanalabs as the dmabuf
exporter, and EFA as the importer to allow for peer2peer access through
libibverbs.

[1] https://lore.kernel.org/linux-rdma/20210818074352.29950-1-galpress@amazon.com/
[2] https://lore.kernel.org/linux-rdma/20211007104301.76693-1-galpress@amazon.com/

Thanks

Gal Pressman (3):
  dma-buf: Fix pin callback comment
  RDMA/umem: Allow pinned dmabuf umem usage
  RDMA/efa: Add support for dmabuf memory regions

 drivers/infiniband/core/umem_dmabuf.c |  51 +++++++++++
 drivers/infiniband/hw/efa/efa.h       |   4 +
 drivers/infiniband/hw/efa/efa_main.c  |   1 +
 drivers/infiniband/hw/efa/efa_verbs.c | 127 +++++++++++++++++++-------
 include/linux/dma-buf.h               |   4 +-
 include/rdma/ib_umem.h                |  12 +++
 6 files changed, 166 insertions(+), 33 deletions(-)

Comments

Gal Pressman Oct. 26, 2021, 6:10 a.m. UTC | #1
On 12/10/2021 15:09, Gal Pressman wrote:
> Hey all,
>
> This is a followup to my previous RFCs [1][2], which now adds a new api
> to the RDMA subsystem that allows drivers to get a pinned dmabuf memory
> region without requiring an implementation of the move_notify callback.
> The new api makes use of the dynamic attachment api implemented in the
> RDMA subsystem, but calls dma_buf_pin() in order to make sure that the
> callback will not be called, as suggested by Christian.
>
> As explained in the previous RFC, move_notify requires the RDMA device
> to support on-demand-paging (ODP) which is not common on most devices
> (only supported by mlx5).
>
> While the dynamic requirement makes sense for certain GPUs, some devices
> (such as habanalabs) have device memory that is always "pinned" and do
> not need/use the move_notify operation.
>
> Patch #1 changes the dmabuf documentation to make it clear that pinning
> does not necessarily mean the memory must be moved to system memory, it
> is up to the exporter to decide.
> Patch #2 adds the RDMA api that allows drivers to get pinned dmabuf
> memory regions.
> Patch #3 adds the EFA implementation of the dmabuf importer.
>
> The motivation of this submission is to use habanalabs as the dmabuf
> exporter, and EFA as the importer to allow for peer2peer access through
> libibverbs.
>
> [1] https://lore.kernel.org/linux-rdma/20210818074352.29950-1-galpress@amazon.com/
> [2] https://lore.kernel.org/linux-rdma/20211007104301.76693-1-galpress@amazon.com/
>
> Thanks


Hey Jason, did you get a chance to take a look?
Jason Gunthorpe Oct. 27, 2021, 2:52 p.m. UTC | #2
On Tue, Oct 12, 2021 at 03:09:00PM +0300, Gal Pressman wrote:
> Hey all,
> 
> This is a followup to my previous RFCs [1][2], which now adds a new api
> to the RDMA subsystem that allows drivers to get a pinned dmabuf memory
> region without requiring an implementation of the move_notify callback.
> The new api makes use of the dynamic attachment api implemented in the
> RDMA subsystem, but calls dma_buf_pin() in order to make sure that the
> callback will not be called, as suggested by Christian.
> 
> As explained in the previous RFC, move_notify requires the RDMA device
> to support on-demand-paging (ODP) which is not common on most devices
> (only supported by mlx5).
> 
> While the dynamic requirement makes sense for certain GPUs, some devices
> (such as habanalabs) have device memory that is always "pinned" and do
> not need/use the move_notify operation.
> 
> Patch #1 changes the dmabuf documentation to make it clear that pinning
> does not necessarily mean the memory must be moved to system memory, it
> is up to the exporter to decide.
> Patch #2 adds the RDMA api that allows drivers to get pinned dmabuf
> memory regions.
> Patch #3 adds the EFA implementation of the dmabuf importer.
> 
> The motivation of this submission is to use habanalabs as the dmabuf
> exporter, and EFA as the importer to allow for peer2peer access through
> libibverbs.
> 
> [1] https://lore.kernel.org/linux-rdma/20210818074352.29950-1-galpress@amazon.com/
> [2] https://lore.kernel.org/linux-rdma/20211007104301.76693-1-galpress@amazon.com/
> 
> Thanks
> 
> Gal Pressman (3):
>   dma-buf: Fix pin callback comment
>   RDMA/umem: Allow pinned dmabuf umem usage
>   RDMA/efa: Add support for dmabuf memory regions

Applied to for-next, thanks

Jason