lkml.org 
[lkml]   [2008]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRE: Why get_user_pages fails?
Yes, I totally agree with you that the best solution is to bypass the Linux VM.
The reason to continue using get_user_pages() is that we can leverage the existing kernel driver - the SCST.

Do I have a way to map a range of phy memory to user virtual address and have the page structures built for that memory region?
I know remap_pfn_range() doesn't work.

Weimin

-----Original Message-----
From: Jonathan Corbet [mailto:corbet@lwn.net]
Sent: Monday, June 30, 2008 2:52 PM
To: Pan, Weimin
Cc: linux-kernel@vger.kernel.org
Subject: Re: Why get_user_pages fails?

On Mon, 30 Jun 2008 19:32:41 +0000
"Pan, Weimin" <weimin.pan@hp.com> wrote:

> I booted the kernel and set "mem=512M" and then mmapped the physical
> memory above 512M to user space and got the user space virtual address
> for that memory. When I passed that address to my driver to do direct
> IO. The get_user_pages() in my driver fails. I found that this is due
> to the VM_IO and VM_PFNMAP are set. Does that mean the page structures
> are not built when I mmapped physical memory to user space (using
> remap_pfn_range())?
>
> Do I have a way to solve this problem? How can I map the physical
> memory to user space virtual address and can pass this address to my
> driver to do direct IO by using get_user_pages() function?

In this situation, you already know where the memory sits in physical space, and there's no point in trying to pin it. So a call to
get_user_pages() is entirely unnecessary. You're bypassing the Linux VM, so bypass it entirely.

However, this whole scheme seems a little...baroque. Why are you doing things this way? As always in such cases, posting your code can enable others to help you find the right solution to your problem.

jon


\
 
 \ /
  Last update: 2008-06-30 22:49    [W:0.036 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site