public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Yanjun Zhu <yanjun.zhu@linux.dev>
To: Jason Gunthorpe <jgg@ziepe.ca>, Zhu Yanjun <yanjun.zhu@intel.com>
Cc: zyjzyj2000@gmail.com, leon@kernel.org,
	linux-rdma@vger.kernel.org, Zhu Yanjun <yanjun.zhu@linux.dev>
Subject: Re: [for-next PATCH 1/1] RDMA/rxe: sgt_append from ib_umem_get is not highmem
Date: Tue, 22 Nov 2022 12:07:06 +0800	[thread overview]
Message-ID: <6cb433cb-c463-7cd8-ee5e-7e922733744a@linux.dev> (raw)
In-Reply-To: <Y3uZMQJgcNFDhq5L@ziepe.ca>

在 2022/11/21 23:28, Jason Gunthorpe 写道:
> On Sat, Nov 19, 2022 at 08:29:38PM -0500, 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.
> 
> You've confused the allocation of the SGL table itself with the
> page_address called on the struct page * stored inside the SGL table.
> 
> Think of the SGL as an array of 'struct page *'
> 
About "The page_address() can return NULL because the 'struct page *' it 
  contains came from userspace and could very will be highmem.",

 From the function ib_umem *ib_umem_get(struct ib_device *device, 
unsigned long addr,size_t size, int access), I agree with you that 
struct page comes from user space.

But from "Understanding the Linux Kernel", third edition - sections 
"8.1.3. Memory Zones" and "8.1.6. Kernel Mappings of High-Memory Page 
Frames".

In the process' virtual address space, the user space occupies the first 
3GB, and the kernel space the 4th GB of this linear address space.

The first 896MB of the kernel space (not only kernel code, but its data 
also) is "directly" mapped to the first 896 MB of the physical memory.

The last 128MB part of the virtual kernel space is where are mapped some 
pieces of the physical "high memory" (> 896MB) : thus it can only map no 
more than 128MB of "high memory" at a time.

It seems that page_address of these "128MB high memory" will return NULL.

But can user space access these high memory? From "Understanding the 
Linux Kernel", third edition, it seems that it is in kernel space.

Thanks and Regards,
Zhu Yanjun

> 
> Jason


  reply	other threads:[~2022-11-22  4:07 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
2022-11-21 15:28       ` Jason Gunthorpe
2022-11-22  4:07         ` Yanjun Zhu [this message]
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=6cb433cb-c463-7cd8-ee5e-7e922733744a@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --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