mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>
To: Bart Van Assche <bvanassche@acm.org>,
	"zyjzyj2000@gmail.com" <zyjzyj2000@gmail.com>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>,
	"leon@kernel.org" <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rpearsonhpe@gmail.com" <rpearsonhpe@gmail.com>,
	"Daisuke Matsuda (Fujitsu)" <matsuda-daisuke@fujitsu.com>,
	"yi.zhang@redhat.com" <yi.zhang@redhat.com>
Subject: Re: [PATCH RFC V2 6/6] RDMA/rxe: Support PAGE_SIZE aligned MR
Date: Mon, 6 Nov 2023 03:07:01 +0000	[thread overview]
Message-ID: <97ebb19c-3df4-4402-9761-edefcfcfa4f7@fujitsu.com> (raw)
In-Reply-To: <d2ccef1e-2bea-4596-8787-8d2491ce0278@acm.org>



On 03/11/2023 23:04, Bart Van Assche wrote:
> 
> On 11/3/23 02:55, Li Zhijian wrote:
>> -    return ib_sg_to_pages(ibmr, sgl, sg_nents, sg_offset, rxe_set_page);
>> +    for_each_sg(sgl, sg, sg_nents, i) {
>> +        u64 dma_addr = sg_dma_address(sg) + sg_offset;
>> +        unsigned int dma_len = sg_dma_len(sg) - sg_offset;
>> +        u64 end_dma_addr = dma_addr + dma_len;
>> +        u64 page_addr = dma_addr & PAGE_MASK;
>> +
>> +        if (sg_dma_len(sg) == 0) {
>> +            rxe_dbg_mr(mr, "empty SGE\n");
>> +            return -EINVAL;
>> +        }
>> +        do {
>> +            int ret = rxe_store_page(mr, page_addr);
>> +            if (ret)
>> +                return ret;
>> +
>> +            page_addr += PAGE_SIZE;
>> +        } while (page_addr < end_dma_addr);
>> +        sg_offset = 0;
>> +    }
>> +
>> +    return ib_sg_to_pages(ibmr, sgl, sg_nents, sg_offset_p, rxe_set_page);
>>   }
> 
> Is this change necessary? 

There is already a loop in ib_sg_to_pages()
> that splits SG entries that are larger than mr->page_size into entries
> with size mr->page_size.

I see.

My thought was that we are only able to safely access PAGE_SIZE memory scope [page_va, page_va + PAGE_SIZE)
from the return of kmap_local_page(page).
However when mr->page_size is larger than PAGE_SIZE, we may access the next pages without mapping it.

Thanks
Zhijian

  reply	other threads:[~2023-11-06  3:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03  9:55 [PATCH RFC V2 0/6] rxe_map_mr_sg() fix cleanup and refactor Li Zhijian
2023-11-03  9:55 ` [PATCH RFC V2 1/6] RDMA/rxe: RDMA/rxe: don't allow registering !PAGE_SIZE mr Li Zhijian
2023-11-03 10:14   ` Greg Sword
2023-11-03  9:55 ` [PATCH RFC V2 2/6] RDMA/rxe: set RXE_PAGE_SIZE_CAP to PAGE_SIZE Li Zhijian
2023-11-03  9:55 ` [PATCH RFC V2 3/6] RDMA/rxe: remove unused rxe_mr.page_shift Li Zhijian
2023-11-03  9:55 ` [PATCH RFC V2 4/6] RDMA/rxe: Use PAGE_SIZE and PAGE_SHIFT to extract address from page_list Li Zhijian
2023-11-03 17:59   ` Jason Gunthorpe
2023-11-03  9:55 ` [PATCH RFC V2 5/6] RDMA/rxe: cleanup rxe_mr.{page_size,page_shift} Li Zhijian
2023-11-03  9:55 ` [PATCH RFC V2 6/6] RDMA/rxe: Support PAGE_SIZE aligned MR Li Zhijian
2023-11-03 15:04   ` Bart Van Assche
2023-11-06  3:07     ` Zhijian Li (Fujitsu) [this message]
2023-11-03 10:17 ` [PATCH RFC V2 0/6] rxe_map_mr_sg() fix cleanup and refactor Greg Sword
2023-11-06  3:46   ` Zhijian Li (Fujitsu)
2023-11-03 13:00 ` Zhu Yanjun
2023-11-06  4:07   ` Zhijian Li (Fujitsu)
2023-11-06 13:58     ` Zhu Yanjun
2023-11-09  2:24       ` Zhijian Li (Fujitsu)
2023-11-09  6:36         ` Zhu Yanjun
2023-11-09  7:16         ` Greg Sword
2023-11-09  7:26           ` Zhijian Li (Fujitsu)
2023-11-09 13:10           ` Jason Gunthorpe
2023-11-06 14:13     ` Jason Gunthorpe
2023-11-06  7:59 ` Zhijian Li (Fujitsu)
2023-11-06  9:35   ` Greg Sword
2023-11-06  9:55     ` Zhijian Li (Fujitsu)

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=97ebb19c-3df4-4402-9761-edefcfcfa4f7@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=yi.zhang@redhat.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®