Re: [patch 5/6] mmu_notifier: Support for drivers with revers maps (f.e. for XPmem)



On Wednesday 20 February 2008 20:00, Robin Holt wrote:
On Wed, Feb 20, 2008 at 02:51:45PM +1100, Nick Piggin wrote:
On Wednesday 20 February 2008 14:12, Robin Holt wrote:
For XPMEM, we do not currently allow file backed
mapping pages from being exported so we should never reach this
condition. It has been an issue since day 1. We have operated with
that assumption for 6 years and have not had issues with that
assumption. The user of xpmem is MPT and it controls the communication
buffers so it is reasonable to expect this type of behavior.

OK, that makes things simpler.

So why can't you export a device from your xpmem driver, which
can be mmap()ed to give out "anonymous" memory pages to be used
for these communication buffers?

Because we need to have heap and stack available as well. MPT does
not control all the communication buffer areas. I haven't checked, but
this is the same problem that IB will have. I believe they are actually
allowing any memory region be accessible, but I am not sure of that.

Then you should create a driver that the user program can register
and unregister regions of their memory with. The driver can do a
get_user_pages to get the pages, and then you'd just need to set up
some kind of mapping so that userspace can unmap pages / won't leak
memory (and an exit_mm notifier I guess).

Because you don't need to swap, you don't need coherency, and you
are in control of the areas, then this seems like the best choice.
It would allow you to use heap, stack, file-backed, anything.

--
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: [PATCH] drivers/base: export gpl (un)register_memory_notifier
    ... If a driver doesn't know anything else about the mapping structure, ... the normal solution in kernel for this type of problem is a multi ... This doesn't sound right to be implemented in a device driver. ... When the memory is in a particular configuration (range of memory ...
    (Linux-Kernel)
  • Re: Freeing mmapped memory
    ... Now i want user processes to be able to access this memory using ... mmap and i want to free this memory when it is no longer needed. ... Unfortunately the mapping doesn't seem to hold a reference to the ... in the close function of my driver but the mapping is still there. ...
    (freebsd-hackers)
  • Re: Unsized Arrays in Structures, and user space
    ... > Windows 2k/XP/2k3 Filesystem and Driver Consulting ... what are you suggesting for sharing memory between the driver ... >>> Well first mapping anything to user space that was allocated in the ...
    (microsoft.public.development.device.drivers)
  • Re: [patch 5/6] mmu_notifier: Support for drivers with revers maps (f.e. for XPmem)
    ... for these communication buffers? ... not control all the communication buffer areas. ... allowing any memory region be accessible, but I am not sure of that. ... Then you should create a driver that the user program can register ...
    (Linux-Kernel)
  • [PATCH 2/2] BDI: Improve nommu mmap support
    ... The attached patch makes use of patch #1 to improve nommu mmap support; ... permitting direct mapping of flash chips and the problems of XIP vs write. ... - we support chardevs that provide their own "memory" ... driver or filesystem so that the contents can be read into the memory ...
    (Linux-Kernel)