Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH rdma-next 0/3] RDMA/mlx5: Support pinned revocable dma-buf import
@ 2026-11-28 13:36 Edward Srouji
  2026-11-28 13:36 ` [PATCH rdma-next 1/3] RDMA/uverbs: Permit dma-buf export to work with pinned importers Edward Srouji
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Edward Srouji @ 2026-11-28 13:36 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky, Sumit Semwal,
	Christian König, Philipp Stanner
  Cc: linux-rdma, linux-kernel, linux-media, dri-devel, linaro-mm-sig,
	Edward Srouji, Chiara Meiohas, Yishai Hadas

Today mlx5 imports every dma-buf as movable. The mkey is sized for the
worst case, one entry per PAGE_SIZE of the dma-buf, and an invalidation
zaps the mkey and relies on ODP page faults to map it again. This makes
dma-buf MRs depend on CONFIG_INFINIBAND_ON_DEMAND_PAGING, and wastes
translation entries for exporters that never move their memory, such as
when GPU or device memory is registered for peer-to-peer DMA.

Exporters of PCI BAR memory, VFIO and the uverbs dma-buf export, do not
move the memory, but they must be able to take it away on a reset or a
memory-disable. The dma-buf core supports this with pinned revocable
attachments (dma_buf_attach_revocable()), and irdma already imports
dma-bufs this way, see commit 4707bf5f6c86 ("RDMA/irdma: Add support for
revocable pinned dmabuf import").

This series adds the same support to mlx5:

- Patch 1 lets the uverbs dma-buf export accept pinned importers that
  can handle a revoke.

- Patch 2 moves the dma-buf MR init out of the ODP-only odp.c into mr.c,
  with no functional change.

- Patch 3 makes mlx5 try a pinned revocable import first. When the
  exporter grants it, the buffer cannot move, so the mkey is sized
  exactly to its mapping. Otherwise mlx5 falls back to the existing
  movable import, which is the only case that still requires ODP. On a
  revoke the mkey is disabled with a UMR, so the device stops accessing
  the buffer before the exporter takes the memory away.

Signed-off-by: Edward Srouji <edwards@nvidia.com>
---
Chiara Meiohas (2):
      RDMA/uverbs: Permit dma-buf export to work with pinned importers
      RDMA/mlx5: Move dma-buf MR init out of ODP-only compilation

Yishai Hadas (1):
      RDMA/mlx5: Try pinned revocable dmabuf import by default

 drivers/infiniband/core/uverbs_std_types_dmabuf.c |  14 +-
 drivers/infiniband/hw/mlx5/mlx5_ib.h              |   7 +-
 drivers/infiniband/hw/mlx5/mr.c                   | 187 ++++++++++++++++++++--
 drivers/infiniband/hw/mlx5/odp.c                  |  58 +------
 4 files changed, 185 insertions(+), 81 deletions(-)
---
base-commit: 94e81a1f3ffabb388f7d0a9674bb1d3acc067e00
change-id: 20261128-mlx5-pinned-revocable-dmabuf-31e90029af9e

Best regards,
-- 
Edward Srouji <edwards@nvidia.com>


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

end of thread, other threads:[~2026-11-28 13:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 13:36 [PATCH rdma-next 0/3] RDMA/mlx5: Support pinned revocable dma-buf import Edward Srouji
2026-11-28 13:36 ` [PATCH rdma-next 1/3] RDMA/uverbs: Permit dma-buf export to work with pinned importers Edward Srouji
2026-11-28 13:36 ` [PATCH rdma-next 2/3] RDMA/mlx5: Move dma-buf MR init out of ODP-only compilation Edward Srouji
2026-11-28 13:36 ` [PATCH rdma-next 3/3] RDMA/mlx5: Try pinned revocable dmabuf import by default Edward Srouji
2026-11-28 13:59   ` sashiko-bot
2026-11-28 13:59 ` [PATCH rdma-next 0/3] RDMA/mlx5: Support pinned revocable dma-buf import sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox