DragonFly BSD
DragonFly kernel List (threaded) for 2006-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: vmapbuf confusion


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 16 Feb 2006 21:33:54 -0800 (PST)

:
:I'm working on a kernel driver that implements read()/write() and ran
:across something I didn't expect. The d_write_t entry point mimics
:what CAM does for user space buffers: allocates a struct buf, fills in
:the pointers and lengths from the struct uio, and calls vmapbuf() to
:get a KVA. Due to a (dumb) logic bug, the driver never called
:vmapbuf(), but access from the kernel to that user space address seem
:to work just fine. So is the call to vmapbuf() unnecessary? Is it only
:needed some of the time? If so, when? As always, any pointers are most
:appreciated.
:
:---chuck

    Device drivers need a stable KVA-mapped memory.  It only seems
    to work with the pointer to user memory because the user memory
    happened to be faulted in for the duration of the I/O and
    because the I/O happened to occur in the context of the user process.
    This isn't always going to be the case with a device write.

    So the answer is that you do have to call vmapbuf().

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]