All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-next 0/9] RDMA/core: Introduce FRMR pools infrastructure
@ 2025-11-16 19:10 Edward Srouji
  2025-11-16 19:10 ` [PATCH rdma-next 1/9] IB/core: Introduce FRMR pools Edward Srouji
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Edward Srouji @ 2025-11-16 19:10 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky, Saeed Mahameed, Tariq Toukan,
	Mark Bloch, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, linux-rdma, netdev, Michael Guralnik, Edward Srouji,
	Yishai Hadas, Patrisious Haddad

From Michael:

This patch series introduces a new FRMR (Fast Registration Memory Region)
pool infrastructure for the RDMA core subsystem. The goal is to provide
efficient management and allow reuse of MRs (Memory Regions) for RDMA
device drivers.

Background
==========

Memory registration and deregistration can be a significant bottleneck in
RDMA applications that need to register memory regions dynamically in
their data path or must re-register memory on application restart.
Repeatedly allocating and freeing these resources introduces overhead,
particularly in high-throughput or latency-sensitive environments where
memory regions are frequently cycled. Notably, the mlx5_ib driver has
already adopted memory registration reuse mechanisms and has demonstrated
notable performance improvements as a result.

Device driver integration requires the ability to modify the hardware
objects underlying MRs when reusing FRMR handles, allowing the update
of pre-allocated handles to fit the parameters of requested MR
registrations. The FRMR pools manage memory region handles with respect
to attributes that cannot be changed after allocation such as access flags,
ATS capabilities, vendor keys, and DMA block size so each pool is uniquely
characterized by these non-modifiable attributes.
This ensures compatibility and correctness while allowing drivers
flexibility in managing other aspects of the MR lifecycle.

Solution Overview
=================

This patch series introduces a centralized, per-device FRMR pooling
infrastructure that provides:

1. Pool Organization: Uses an RB-tree to organize pools by FRMR
   characteristics (ATS support, access flags, vendor-specific keys,
   and DMA block count). This allows efficient lookup and reuse of
   compatible FRMR handles.

2. Dynamic Allocation: Pools grow dynamically on demand when no cached
   handles are available, ensuring optimal memory usage without
   sacrificing performance.

3. Aging Mechanism: Implements an aging system. Unused handles are
   gradually moved to the freed after a configurable aging period
   (default: 60 seconds), preventing memory bloat during idle periods.

4. Pinned Handles: Supports pinning a minimum number of handles per
   pool to maintain performance for latency-sensitive workloads, avoiding
   allocation overhead on critical paths.

5. Driver Flexibility: Provides a callback-based interface
   (ib_frmr_pool_ops) that allows drivers to implement their own FRMR
   creation/destruction logic while leveraging the common pooling
   infrastructure.

API
===

The infrastructure exposes the following APIs:

- ib_frmr_pools_init(): Initialize FRMR pools for a device
- ib_frmr_pools_cleanup(): Clean up all pools for a device
- ib_frmr_pool_pop(): Get an FRMR handle from the pool
- ib_frmr_pool_push(): Return an FRMR handle to the pool
- ib_frmr_pools_set_aging_period(): Configure aging period
- ib_frmr_pools_set_pinned(): Set minimum pinned handles per pool

Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
---
Michael Guralnik (9):
      IB/core: Introduce FRMR pools
      RDMA/core: Add aging to FRMR pools
      RDMA/core: Add FRMR pools statistics
      RDMA/core: Add pinned handles to FRMR pools
      RDMA/mlx5: Switch from MR cache to FRMR pools
      net/mlx5: Drop MR cache related code
      RDMA/nldev: Add command to get FRMR pools
      RDMA/core: Add netlink command to modify FRMR aging
      RDMA/core: Add command to set pinned FRMR handles

 drivers/infiniband/core/Makefile               |    2 +-
 drivers/infiniband/core/frmr_pools.c           |  553 ++++++++++++
 drivers/infiniband/core/frmr_pools.h           |   63 ++
 drivers/infiniband/core/nldev.c                |  347 +++++++
 drivers/infiniband/hw/mlx5/main.c              |    7 +-
 drivers/infiniband/hw/mlx5/mlx5_ib.h           |   86 +-
 drivers/infiniband/hw/mlx5/mr.c                | 1141 ++++--------------------
 drivers/infiniband/hw/mlx5/odp.c               |   19 -
 drivers/infiniband/hw/mlx5/umr.h               |    1 +
 drivers/net/ethernet/mellanox/mlx5/core/main.c |   67 +-
 include/linux/mlx5/driver.h                    |   11 -
 include/rdma/frmr_pools.h                      |   39 +
 include/rdma/ib_verbs.h                        |    8 +
 include/uapi/rdma/rdma_netlink.h               |   21 +
 14 files changed, 1219 insertions(+), 1146 deletions(-)
---
base-commit: d056bc45b62b5981ebcd18c4303a915490b8ebe9
change-id: 20251116-frmr_pools-f823cc5e8a58

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


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

end of thread, other threads:[~2025-11-17 18:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-16 19:10 [PATCH rdma-next 0/9] RDMA/core: Introduce FRMR pools infrastructure Edward Srouji
2025-11-16 19:10 ` [PATCH rdma-next 1/9] IB/core: Introduce FRMR pools Edward Srouji
2025-11-16 19:10 ` [PATCH rdma-next 2/9] RDMA/core: Add aging to " Edward Srouji
2025-11-16 19:10 ` [PATCH rdma-next 3/9] RDMA/core: Add FRMR pools statistics Edward Srouji
2025-11-16 19:10 ` [PATCH rdma-next 4/9] RDMA/core: Add pinned handles to FRMR pools Edward Srouji
2025-11-16 19:10 ` [PATCH rdma-next 5/9] RDMA/mlx5: Switch from MR cache " Edward Srouji
2025-11-16 19:10 ` [PATCH rdma-next 6/9] net/mlx5: Drop MR cache related code Edward Srouji
2025-11-16 19:10 ` [PATCH rdma-next 7/9] RDMA/nldev: Add command to get FRMR pools Edward Srouji
2025-11-16 19:10 ` [PATCH rdma-next 8/9] RDMA/core: Add netlink command to modify FRMR aging Edward Srouji
2025-11-16 19:10 ` [PATCH rdma-next 9/9] RDMA/core: Add command to set pinned FRMR handles Edward Srouji
2025-11-17 18:18   ` kernel test robot

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.