Re: kiobuf using kernel pages

Keith Owens (kaos@ocs.com.au)
Thu, 11 Nov 1999 22:05:31 +1100


On Thu, 11 Nov 1999 10:46:13 +0000 (GMT),
"Stephen C. Tweedie" <sct@redhat.com> wrote:
>On Thu, 11 Nov 1999 12:08:25 +0100 (CET), Ingo Molnar
><mingo@chiara.csoma.elte.hu> said:
>> On Thu, 11 Nov 1999, Keith Owens wrote:
>>> Trying to port the SGI lcrash code to 2.3.26 ix86. It compiles, runs,
>>> traps the oops, starts writing the dump to swap, dies with -EFAULT in
>>> sd_raw_rw. My guess is because the buffer address is c2c00000, i.e. I
>>> am trying to do I/O directly from kernel pages, not from user space.
>>> sd_raw_rw() calls map_user_kiobuf() which is perfect for user space
>>> callers, no good for kernel callers. How do I get around this?
>
>> yes, map_user_kiobuf() works only on user addresses.
>
>SGI's code added support for other address spaces in kiobufs. Either
>way, the addresses you pass to IO functions should be kernel virtual
>addresses anyway if you are passing kiobufs.

They use hard wired tests for filp->f_reada == DUMP_KIOBUF_NUMBER then
pass an AS_ parameter to the low level routine along with the kiobuf.
Not really a long term solution, every new use of kernel buffers would
require yet another test for f_reada.

>I'm actually working on the kiobuf code right now, mainly to separate
>out the locking of pages from the mapping of virtual addresses, and
>getting kernel VA mapping functions in place is one thing I'm merging.

The problem is that sd_raw_{read,write} can be called from kernel or
user space and those routines need some simple way of telling what
buffers their caller is using. What about a flag in the filp saying
"this filp uses kernel buffers"? Normal opens do not set it and use
user buffers, kernel code sets the flag and uses kernel buffers. That
would be a clean general solution.

-
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/