Skip to content

Commit 07549ee

Browse files
Max Gurtovoyjgunthorpe
authored andcommitted
RDMA/rds: Remove FMR support for memory registration
Use FRWR method for memory registration by default and remove the ancient and unsafe FMR method. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Max Gurtovoy <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent f273ad4 commit 07549ee

File tree

8 files changed

+21
-322
lines changed

8 files changed

+21
-322
lines changed

net/rds/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ rds-y := af_rds.o bind.o cong.o connection.o info.o message.o \
77
obj-$(CONFIG_RDS_RDMA) += rds_rdma.o
88
rds_rdma-y := rdma_transport.o \
99
ib.o ib_cm.o ib_recv.o ib_ring.o ib_send.o ib_stats.o \
10-
ib_sysctl.o ib_rdma.o ib_fmr.o ib_frmr.o
10+
ib_sysctl.o ib_rdma.o ib_frmr.o
1111

1212

1313
obj-$(CONFIG_RDS_TCP) += rds_tcp.o

net/rds/ib.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,16 @@ void rds_ib_dev_put(struct rds_ib_device *rds_ibdev)
130130
static int rds_ib_add_one(struct ib_device *device)
131131
{
132132
struct rds_ib_device *rds_ibdev;
133-
bool has_fr, has_fmr;
134133
int ret;
135134

136135
/* Only handle IB (no iWARP) devices */
137136
if (device->node_type != RDMA_NODE_IB_CA)
138137
return -EOPNOTSUPP;
139138

139+
/* Device must support FRWR */
140+
if (!(device->attrs.device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS))
141+
return -EOPNOTSUPP;
142+
140143
rds_ibdev = kzalloc_node(sizeof(struct rds_ib_device), GFP_KERNEL,
141144
ibdev_to_node(device));
142145
if (!rds_ibdev)
@@ -152,11 +155,6 @@ static int rds_ib_add_one(struct ib_device *device)
152155
rds_ibdev->max_wrs = device->attrs.max_qp_wr;
153156
rds_ibdev->max_sge = min(device->attrs.max_send_sge, RDS_IB_MAX_SGE);
154157

155-
has_fr = (device->attrs.device_cap_flags &
156-
IB_DEVICE_MEM_MGT_EXTENSIONS);
157-
has_fmr = (device->ops.alloc_fmr && device->ops.dealloc_fmr &&
158-
device->ops.map_phys_fmr && device->ops.unmap_fmr);
159-
rds_ibdev->use_fastreg = (has_fr && !has_fmr);
160158
rds_ibdev->odp_capable =
161159
!!(device->attrs.device_cap_flags &
162160
IB_DEVICE_ON_DEMAND_PAGING) &&
@@ -165,7 +163,6 @@ static int rds_ib_add_one(struct ib_device *device)
165163
!!(device->attrs.odp_caps.per_transport_caps.rc_odp_caps &
166164
IB_ODP_SUPPORT_READ);
167165

168-
rds_ibdev->fmr_max_remaps = device->attrs.max_map_per_fmr?: 32;
169166
rds_ibdev->max_1m_mrs = device->attrs.max_mr ?
170167
min_t(unsigned int, (device->attrs.max_mr / 2),
171168
rds_ib_mr_1m_pool_size) : rds_ib_mr_1m_pool_size;
@@ -219,14 +216,11 @@ static int rds_ib_add_one(struct ib_device *device)
219216
goto put_dev;
220217
}
221218

222-
rdsdebug("RDS/IB: max_mr = %d, max_wrs = %d, max_sge = %d, fmr_max_remaps = %d, max_1m_mrs = %d, max_8k_mrs = %d\n",
219+
rdsdebug("RDS/IB: max_mr = %d, max_wrs = %d, max_sge = %d, max_1m_mrs = %d, max_8k_mrs = %d\n",
223220
device->attrs.max_fmr, rds_ibdev->max_wrs, rds_ibdev->max_sge,
224-
rds_ibdev->fmr_max_remaps, rds_ibdev->max_1m_mrs,
225-
rds_ibdev->max_8k_mrs);
221+
rds_ibdev->max_1m_mrs, rds_ibdev->max_8k_mrs);
226222

227-
pr_info("RDS/IB: %s: %s supported and preferred\n",
228-
device->name,
229-
rds_ibdev->use_fastreg ? "FRMR" : "FMR");
223+
pr_info("RDS/IB: %s: added\n", device->name);
230224

231225
down_write(&rds_ib_devices_lock);
232226
list_add_tail_rcu(&rds_ibdev->list, &rds_ib_devices);

net/rds/ib.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,11 @@ struct rds_ib_device {
247247
struct ib_device *dev;
248248
struct ib_pd *pd;
249249
struct dma_pool *rid_hdrs_pool; /* RDS headers DMA pool */
250-
u8 use_fastreg:1;
251250
u8 odp_capable:1;
252251

253252
unsigned int max_mrs;
254253
struct rds_ib_mr_pool *mr_1m_pool;
255254
struct rds_ib_mr_pool *mr_8k_pool;
256-
unsigned int fmr_max_remaps;
257255
unsigned int max_8k_mrs;
258256
unsigned int max_1m_mrs;
259257
int max_sge;

net/rds/ib_cm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,10 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
527527
return -EOPNOTSUPP;
528528

529529
/* The fr_queue_space is currently set to 512, to add extra space on
530-
* completion queue and send queue. This extra space is used for FRMR
530+
* completion queue and send queue. This extra space is used for FRWR
531531
* registration and invalidation work requests
532532
*/
533-
fr_queue_space = (rds_ibdev->use_fastreg ? RDS_IB_DEFAULT_FR_WR : 0);
533+
fr_queue_space = RDS_IB_DEFAULT_FR_WR;
534534

535535
/* add the conn now so that connection establishment has the dev */
536536
rds_ib_add_conn(rds_ibdev, conn);

net/rds/ib_fmr.c

Lines changed: 0 additions & 269 deletions
This file was deleted.

net/rds/ib_frmr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static struct rds_ib_mr *rds_ib_alloc_frmr(struct rds_ib_device *rds_ibdev,
7676

7777
frmr = &ibmr->u.frmr;
7878
frmr->mr = ib_alloc_mr(rds_ibdev->pd, IB_MR_TYPE_MEM_REG,
79-
pool->fmr_attr.max_pages);
79+
pool->max_pages);
8080
if (IS_ERR(frmr->mr)) {
8181
pr_warn("RDS/IB: %s failed to allocate MR", __func__);
8282
err = PTR_ERR(frmr->mr);
@@ -240,7 +240,7 @@ static int rds_ib_map_frmr(struct rds_ib_device *rds_ibdev,
240240
}
241241
frmr->dma_npages += len >> PAGE_SHIFT;
242242

243-
if (frmr->dma_npages > ibmr->pool->fmr_attr.max_pages) {
243+
if (frmr->dma_npages > ibmr->pool->max_pages) {
244244
ret = -EMSGSIZE;
245245
goto out_unmap;
246246
}

0 commit comments

Comments
 (0)