The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Andrew Stellman <bugs@stellman-greene.com>,
	Zhu Yanjun <zyjzyj2000@gmail.com>,
	"yanjun.zhu@linux.dev" <yanjun.zhu@linux.dev>
Cc: Li Zhijian <lizhijian@fujitsu.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH rdma-rc] RDMA/rxe: Bound MR copy and flush chunks to MR pages
Date: Sun, 29 Nov 2026 11:16:37 -0800	[thread overview]
Message-ID: <87a40abe-30e3-414c-ac13-ed166c91239d@linux.dev> (raw)
In-Reply-To: <20261129135306.80838-1-bugs@stellman-greene.com>


在 2026/11/29 5:53, Andrew Stellman 写道:
> On Sat, Nov 28, 2026 at 04:36:17PM -0800, Zhu Yanjun wrote:
>> Do you make tests in your local host? Or just use AI to make static
>> analysis?
> My last reply was from reading the source. After your question I ran
> 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.
Below is the implementation of mr_page_size:

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


      reply	other threads:[~2026-11-29 19:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 14:08 [PATCH rdma-rc] RDMA/rxe: Bound MR copy and flush chunks to MR pages Andrew Stellman
2026-11-28 17:21 ` Zhu Yanjun
2026-11-29  0:19   ` Andrew Stellman
2026-11-29  0:36     ` Zhu Yanjun
2026-11-29 13:53       ` Andrew Stellman
2026-11-29 19:16         ` Zhu Yanjun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a40abe-30e3-414c-ac13-ed166c91239d@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=bugs@stellman-greene.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox