Re: mapping user space buffer to kernel address space

From: Rogier Wolff (R.E.Wolff@BitWizard.nl)
Date: Sat Oct 14 2000 - 04:18:04 EST


Linus Torvalds wrote:
> In article <CA256977.0039410C.00@d73mta05.au.ibm.com>,
> <mdaljeet@in.ibm.com> wrote:
> >
> >I have a user buffer and i want to map it to kernel address space
> >can anyone tell how to do this like in AIX we have xmattach
>
> Note that it is usually MUCH better to do this the other way around:
> having a kernel-side buffer, and mapping that into user space. I don't
> understand why so many people always want to do it the wrong way around..

Provided this wasn't a retorical question, I'll answer it for you.

It seems easier to people. Allocing megabytes of memory is "easy" from
userspace, and there are all kinds of restrictions on the kernel side.

Also if you could lock the userspace, the interface simplfies: The
"read" systemcall can lock the userspace buffer given, and then
initiate the DMA and return when done. Easy.

If you do it the "right" way, the userspace application will have to
mmap the device, and play signalling tricks with the device to
synchronize when there is data.

So people percieve it easier to lock the userspace memeory for the DMA
into it than to map the kernel-buffer into userspace.

                                Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
*       Common sense is the collection of                                *
******  prejudices acquired by age eighteen.   -- Albert Einstein ********
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:27 EST