Re: Why get_user_pages fails?



On Mon, 30 Jun 2008 19:32:41 +0000
"Pan, Weimin" <weimin.pan@xxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: PCI device driver question
    ... program to find the physical address of the pci device's memory. ... device read and write functions in the pci device driver. ... user space into kernel space (possibly to a small temporary holding ...
    (comp.os.linux.development.system)
  • Re: sleeping and waiting and tasklets
    ... care must be used when accessing user space from kernel code. ... being addressed might not be currently present in memory, ... The net result for the driver writer is that any ... they also check whether the user space pointer is valid. ...
    (comp.os.linux.development.system)
  • Re: + edac-new-opteron-athlon64-memory-controller-driver.patch added to -
    ... So we can kill the processes using that memory. ... What is the chipsets idea of which DIMM the memory error occurred on. ... There has always been enough information to determine the hardware ... some that are not easily accessible to user space so a kernel driver ...
    (Linux-Kernel)
  • RE: Why get_user_pages fails?
    ... I totally agree with you that the best solution is to bypass the Linux VM. ... The reason to continue using get_user_pagesis 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? ... memory above 512M to user space and got the user space virtual address ...
    (Linux-Kernel)
  • Re: user_to_phys() without mmap?
    ... |> ram, not some PCI or AGP video card), but mmap'ing from kernel space ... |> into user space is causing large latencies and unsightly artifacts. ... | virtual memory locations from user space, ... Directly mapping physical memory to a process _can_, of course, be very ...
    (comp.os.linux.development.system)