On 05/03/2013 07:09 AM, Andres Freund wrote:
> We've got that in 9.3 which is absolutely fabulous! But that's not
> related to doing DMA which you cannot (and should not!) do from
> userspace.
You can do zero-copy DMA directly into userspace buffers. It requires
root (or suitable capabilities that land up equivalent to root anyway)
and requires driver support, and it's often a terrible idea, but it's
possible. It's used by a lot of embedded systems, by infiniband, and (if
I vaguely recall correctly) by things like video4linux drivers. You can
use get_user_pages and set the write flag. Linux Device Drivers chapter
15 discusses it.
That said, I think some of the earlier parts of this discussion confused
direct asynchronous I/O with DMA. Within-kernel DMA may be (ok, is) used
to implement DIO, but that doesn't mean you're DMA'ing directly into
userspace buffers.
-- Craig Ringer http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services