Re: [for-next PATCH 4/5] RDMA/rxe: refactor iova_to_vaddr

lizhijian
2022-11-18T01:34:05Z

On 16/11/2022 20:37, Fabio M. De Francesco wrote:
>> - return (void *)(uintptr_t)mr->map[m]->buf[n].addr + offset;
>> + if (mr->ibmr.type == IB_MR_TYPE_USER) {
>> + char *paddr;
>> + struct page *pg = mr->map[m]->buf[n].page;
>> +
>> + paddr = kmap_local_page(pg);
>> + if (paddr == NULL) {
>> + pr_warn("Failed to map page");
>> + return NULL;
>> + }
> I know nothing about this code but I am here as a result of regular checks for
> changes to HIGHMEM mappings across the entire kernel. So please forgive me if
> I'm objecting to the correct changes.
>
> 1) It looks like this code had a call to page_address() and you converted it
> to mapping with kmap_local_page().
>
> If page_address() is related and it used to work properly, the page you are
> mapping cannot come from ZONE_HIGHMEM.

Yes, you are totally right.

Therefore, kmap_local_page() looks like
> an overkill.

The confusion about the page_address() here has been raised for a long
time[1][2].

https://www.spinics.net/lists/linux-rdma/msg113206.html
https://lore.kernel.org/all/20220121160654.GC773547@iweiny-DESK2.sc.intel.com/

Thanks
Zhijian

>
> I'm probably missing something...
>