From: Yanjun Zhu <yanjun.zhu@linux.dev>
To: "lizhijian@fujitsu.com" <lizhijian@fujitsu.com>,
Zhu Yanjun <yanjun.zhu@intel.com>,
"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>
Subject: Re: [for-next PATCH 1/1] RDMA/rxe: sgt_append from ib_umem_get is not highmem
Date: Sat, 19 Nov 2022 21:20:36 +0800 [thread overview]
Message-ID: <2a521299-98c9-885e-c54b-5549f84eaa8f@linux.dev> (raw)
In-Reply-To: <4a9748a0-59d9-4094-8895-6f2194eeb521@fujitsu.com>
在 2022/11/19 18:30, lizhijian@fujitsu.com 写道:
>
> There was a thread that tries to refactor iova_to_vaddr[1][2], where
> page_address will be drop. if so, your changes will be no longer needed.
My commit is to indicate that your commit is not good enough.
And you should make all the related commits in a patch series.
Zhu Yanjun
>
> [1]https://lore.kernel.org/lkml/a7decec2-77d9-db4c-ff66-ff597da8bc71@fujitsu.com/T/
> [2]https://www.spinics.net/lists/linux-rdma/msg114053.html
>
> Thanks
> Zhijian
>
>
> On 20/11/2022 09:29, Zhu Yanjun wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> In ib_umem_get, sgt_append is allocated from the function
>> sg_alloc_append_table_from_pages. And it is not from highmem.
>>
>> As such, the return value of page_address will not be NULL.
>>
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>> ---
>> drivers/infiniband/sw/rxe/rxe_mr.c | 9 ++-------
>> 1 file changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
>> index b1423000e4bc..3f33a4cdef24 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_mr.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
>> @@ -119,7 +119,6 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
>> struct ib_umem *umem;
>> struct sg_page_iter sg_iter;
>> int num_buf;
>> - void *vaddr;
>> int err;
>>
>> umem = ib_umem_get(&rxe->ib_dev, start, length, access);
>> @@ -149,6 +148,8 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
>> buf = map[0]->buf;
>>
>> for_each_sgtable_page (&umem->sgt_append.sgt, &sg_iter, 0) {
>> + void *vaddr;
>> +
>> if (num_buf >= RXE_BUF_PER_MAP) {
>> map++;
>> buf = map[0]->buf;
>> @@ -156,16 +157,10 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
>> }
>>
>> vaddr = page_address(sg_page_iter_page(&sg_iter));
>> - if (!vaddr) {
>> - rxe_dbg_mr(mr, "Unable to get virtual address\n");
>> - err = -ENOMEM;
>> - goto err_release_umem;
>> - }
>> buf->addr = (uintptr_t)vaddr;
>> buf->size = PAGE_SIZE;
>> num_buf++;
>> buf++;
>> -
>> }
>> }
>>
next prev parent reply other threads:[~2022-11-19 13:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-30 3:04 [PATCH for-next v2] RDMA/rxe: Fix mr->map double free Li Zhijian
2022-11-12 3:29 ` lizhijian
2022-11-13 12:40 ` Yanjun Zhu
2022-11-16 0:10 ` Yanjun Zhu
2022-11-16 2:39 ` lizhijian
2022-11-19 0:15 ` Jason Gunthorpe
2022-11-19 8:25 ` Yanjun Zhu
2022-11-20 1:29 ` [for-next PATCH 1/1] RDMA/rxe: sgt_append from ib_umem_get is not highmem Zhu Yanjun
2022-11-19 10:30 ` lizhijian
2022-11-19 13:20 ` Yanjun Zhu [this message]
2022-11-21 15:28 ` Jason Gunthorpe
2022-11-22 4:07 ` Yanjun Zhu
2022-11-22 14:06 ` Jason Gunthorpe
2022-11-23 1:53 ` Yanjun Zhu
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=2a521299-98c9-885e-c54b-5549f84eaa8f@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lizhijian@fujitsu.com \
--cc=yanjun.zhu@intel.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