Sharing memory between user and kernel spaces [Re: copy_to/from_user and a bottom half]

From: Alex Ivchenko (aivchenko@ueidaq.com)
Date: Fri May 19 2000 - 00:12:53 EST


Hi, Andi,

> > I tried to speed up a driver and moved copy_to_user()
> > from ioctl to the bottom half of interrupt handler.
[...]
> You cannot do that. copy_*_user requires a process context, and
> a bottom half does not have one (or at least not the one you want)

Thanks. I really try to search hard thru the HOWTOs and FAQ and
didn't find answer to my questions.
I would very appreciate any ideas or references.

The thing I want to achieve is to get rid of double copying
using copy_to_user() and friends.

I would like to find a way to share big chunk of memory between
user and kernel spaces.

My NT driver works as follows:

1. App allocates memory in user space (page-aligned).
(BTW, I didn't find the way of doing it on Linux beside to allocate
memory with malloc() and then align it to the page boundaries).

2. Inform driver about start address and size.

3. Driver translates user-space address into its virtual address
and locks pages into physical memory.
Now we have two handles (addresses) (kernel and user) to the same
piece of memory.

4. Then one can translate kernel-space virtual address into physical
one to supply to scater-gather BM-capable hardware.

Is it any way to do this with Linux?

Thanks,
Alex

--
Alex Ivchenko, Ph.D.
United Electronic Industries, Inc.
"The High-Performance Alternative (tm)"
--
10 Dexter Avenue
Watertown, Massachusetts 02472
Tel: (617) 924-1155 x 222 Fax: (617) 924-1441
http://www.ueidaq.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:16 EST