Re: [PATCH rdma-rc] RDMA/rxe: Bound MR copy and flush chunks to MR pages
From: Zhu Yanjun
Date: Sun Nov 29 2026 - 14:16:46 EST
在 2026/11/29 5:53, Andrew Stellman 写道:
On Sat, Nov 28, 2026 at 04:36:17PM -0800, Zhu Yanjun wrote:Below is the implementation of mr_page_size:
Do you make tests in your local host? Or just use AI to make staticMy last reply was from reading the source. After your question I ran
analysis?
a check in an arm64 QEMU guest on mainline 4f069ab1ec24 plus a
test-only patch (logging and a root-only hook), with 64 KiB pages,
KASAN and rxe:
- Five user MRs registered with ibv_reg_mr, including buffers that
were 4 KiB aligned but not 64 KiB aligned. A pr_info at the top
of rxe_mr_fill_pages_from_sgt() logged mr_page_size=65536 and
PAGE_SIZE=65536 for all five, and the WARN_ON didn't fire.
- A root-only test hook called rxe_mr_init_fast() and then
rxe_map_mr_sg() directly, with the MR page size set to 4 KiB.
rxe_mr_fill_pages_from_sgt() wasn't called.
The v1 patch was tested on mainline 7cd8495c0f16 in an arm64 QEMU
guest with 64 KiB pages and KASAN, using a root-only test hook that
calls rxe_mr_copy() directly. A read and a write across a 4 KiB
MR-page boundary failed without the patch, passed with it, and failed
again with it reverted. The flush path was built but not run.
static inline unsigned int mr_page_size(struct rxe_mr *mr)
{
return mr ? mr->ibmr.page_size : PAGE_SIZE;
}
In the function below, mr->ibmr.page_size is initialized:
void rxe_mr_init(int access, struct rxe_mr *mr)
{
u32 key = mr->elem.index << 8 | rxe_get_next_key(-1);
/* set ibmr->l/rkey and also copy into private l/rkey
* - for user MRs these will always be the same
* - for cases where caller 'owns' the key portion
* - they may be different until REG_MR WQE is executed.
*/
mr->lkey = mr->ibmr.lkey = key;
mr->rkey = mr->ibmr.rkey = key;
mr->access = access;
mr->ibmr.page_size = PAGE_SIZE;
mr->page_mask = PAGE_MASK;
mr->page_shift = PAGE_SHIFT;
mr->state = RXE_MR_STATE_INVALID;
}
Can you find anywhere else where mr->ibmr.page_size is assigned a different value?
Thanks a lot.
Yanjun Zhu
I can send the test-only probe patch and the user program (user-mr.c)
if they'd help.
--
Best Regards,
Yanjun.Zhu