public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 1/2] RDMA/rxe: don't allow registering !PAGE_SIZE mr
@ 2023-10-27  5:41 Li Zhijian
  2023-10-27  5:41 ` [PATCH RFC 2/2] RDMA/rxe: set RXE_PAGE_SIZE_CAP to PAGE_SIZE Li Zhijian
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Li Zhijian @ 2023-10-27  5:41 UTC (permalink / raw)
  To: zyjzyj2000, jgg, leon, linux-rdma
  Cc: linux-kernel, rpearsonhpe, matsuda-daisuke, bvanassche,
	Li Zhijian

mr->page_list only encodes *page without page offset, when
page_size != PAGE_SIZE, we cannot restore the address with a wrong
page_offset.

Note that this patch will break some ULPs that try to register 4K
MR when PAGE_SIZE is not 4K.
SRP and nvme over RXE is known to be impacted.

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
 drivers/infiniband/sw/rxe/rxe_mr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
index f54042e9aeb2..61a136ea1d91 100644
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@ -234,6 +234,12 @@ int rxe_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sgl,
 	struct rxe_mr *mr = to_rmr(ibmr);
 	unsigned int page_size = mr_page_size(mr);
 
+	if (page_size != PAGE_SIZE) {
+		rxe_info_mr(mr, "Unsupported MR with page_size %u, expect %lu\n",
+			   page_size, PAGE_SIZE);
+		return -EOPNOTSUPP;
+	}
+
 	mr->nbuf = 0;
 	mr->page_shift = ilog2(page_size);
 	mr->page_mask = ~((u64)page_size - 1);
-- 
2.41.0


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

end of thread, other threads:[~2023-11-01  0:58 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-27  5:41 [PATCH RFC 1/2] RDMA/rxe: don't allow registering !PAGE_SIZE mr Li Zhijian
2023-10-27  5:41 ` [PATCH RFC 2/2] RDMA/rxe: set RXE_PAGE_SIZE_CAP to PAGE_SIZE Li Zhijian
2023-10-27 21:47   ` Bart Van Assche
2023-10-28  3:52   ` Zhu Yanjun
2023-10-27  8:17 ` [PATCH RFC 1/2] RDMA/rxe: don't allow registering !PAGE_SIZE mr Zhu Yanjun
2023-10-27 21:46   ` Bart Van Assche
2023-10-28  2:48     ` Zhu Yanjun
2023-10-28 23:07       ` Bart Van Assche
2023-10-29  3:22         ` Zhu Yanjun
2023-10-30  8:13   ` Zhijian Li (Fujitsu)
2023-10-30  9:43     ` Zhu Yanjun
2023-10-30  7:51 ` Zhijian Li (Fujitsu)
2023-10-30 12:40   ` Jason Gunthorpe
2023-10-31  8:52     ` Zhu Yanjun
2023-10-31 13:19       ` Jason Gunthorpe
2023-11-01  0:58         ` Greg Sword
2023-10-31  9:59     ` Zhijian Li (Fujitsu)

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