Re: user_to_phys() without mmap?
- From: Rainer Weikusat <rweikusat@xxxxxxxxxxx>
- Date: Sun, 15 Jul 2007 00:20:45 +0200
Neil Steiner <neil.steiner@xxxxxx> writes:
I'm trying to use a framebuffer from user space (think plain video
ram, not some PCI or AGP video card), but mmap'ing from kernel space
into user space is causing large latencies and unsightly artifacts.
It appears that anything written into the mmap'ed user memory is in
fact being copied into kernel space.
Theoretically, this could probably be implemented with help of the
MMU and some 'weird' fault handling, but I don't think someone would
take the trouble, because it seems pretty useless. The /dev/mem driver
certainly doesn't do this. Only the MMU will interfere accesses to
virtual memory locations from user space, except for faults caused by
this accesses.
What I was actually hoping was that the memory manager would simply
map the underlying physical pages directly into the user's address
space. I think that's simple enough to do in theory, but there is
much that I don't know about Linux kernel internals, so in practice
who knows?
I do :-). But the code isn't really that complicated. What it
basically does is set up page table entries for the range you
requested. Assuming you are using /dev/mem, could it be possible
that you are accessing cached memory?
static int mmap_mem(struct file * file, struct vm_area_struct * vma)
{
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
/*
* Accessing memory above the top the kernel knows about or
* through a file pointer that was marked O_SYNC will be
* done non-cached.
*/
if (noncached_address(offset) || (file->f_flags & O_SYNC))
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
(../linux/drivers/char/mem.c)
.
- Follow-Ups:
- Re: user_to_phys() without mmap?
- From: Neil Steiner
- Re: user_to_phys() without mmap?
- From: phil-news-nospam
- Re: user_to_phys() without mmap?
- References:
- user_to_phys() without mmap?
- From: Neil Steiner
- user_to_phys() without mmap?
- Prev by Date: user_to_phys() without mmap?
- Next by Date: Re: BGP Job Opening
- Previous by thread: user_to_phys() without mmap?
- Next by thread: Re: user_to_phys() without mmap?
- Index(es):
Relevant Pages
|