mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: "zyjzyj2000@gmail.com" <zyjzyj2000@gmail.com>,
	"leon@kernel.org" <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rpearsonhpe@gmail.com" <rpearsonhpe@gmail.com>,
	"Daisuke Matsuda (Fujitsu)" <matsuda-daisuke@fujitsu.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>
Subject: Re: [PATCH RFC 1/2] RDMA/rxe: don't allow registering !PAGE_SIZE mr
Date: Tue, 31 Oct 2023 09:59:54 +0000	[thread overview]
Message-ID: <80ea66c5-2afc-43c5-b1f5-66cc2e62295d@fujitsu.com> (raw)
In-Reply-To: <20231030124041.GE691768@ziepe.ca>



On 30/10/2023 20:40, Jason Gunthorpe wrote:
> On Mon, Oct 30, 2023 at 07:51:41AM +0000, Zhijian Li (Fujitsu) wrote:
>>
>>
>> On 27/10/2023 13:41, Li Zhijian wrote:
>>> 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) {
>>
>> It seems this condition is too strict, it should be:
>> 	if (!IS_ALIGNED(page_size, PAGE_SIZE))
>>

I have to say I retract this conclusion. It still misses something.

To support PAGE_SIZE aligned MR, we have to refactor rxe_map_mr_sg() or rxe_set_page()

Currently, rxe_set_page() will be called in the step of page_size, this doesn't split N*PAGE_SIZE memory into
N *page. So when we restore an iova from xarray, the array index is wrong as well.

So i'm going to refactor rxe_map_mr_sg() to iterate the sgl by myself in rxe_map_mr_sg() like SIW does.
Hope this refactor can help RXE to support SZ_4K when PAGE_SIZE!=4K as well.


Thanks
Zhijian


>> So that, page_size with (N * PAGE_SIZE) can work as previously.
>> Because the offset(mr.iova & page_mask) will get lost only when !IS_ALIGNED(page_size, PAGE_SIZE)
> 
> That makes sense
> 
> Jason

      parent reply	other threads:[~2023-10-31 10:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
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 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=80ea66c5-2afc-43c5-b1f5-66cc2e62295d@fujitsu.com \
    --to=lizhijian@fujitsu.com \
    --cc=bvanassche@acm.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matsuda-daisuke@fujitsu.com \
    --cc=rpearsonhpe@gmail.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

all inboxes | Powered by JetHome®