vmapbuf confusion

Matthew Dillon dillon at apollo.backplane.com
Thu Feb 16 21:42:02 PST 2006


:
: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 at xxxxxxxxxxxxx>





More information about the Kernel mailing list