LWN: Comments on "Driver porting: Zero-copy user-space access" http://lwn.net/Articles/28548/ This is a special feed containing comments posted to the individual LWN article titled "Driver porting: Zero-copy user-space access". hourly 2 Driver porting: Zero-copy user-space access http://lwn.net/Articles/323236/rss 2009-03-13T18:26:12+00:00 will <div class="FormattedComment"> <font class="QuotedText">&gt; For a good example of how to use get_user_pages() in a char driver, see the definition of sgl_map_user_pages() in drivers/scsi/st.c.</font><br> </div> Driver porting: Zero-copy user-space access http://lwn.net/Articles/311949/rss 2008-12-18T06:37:17+00:00 bmasood <div class="FormattedComment"> Bart,<br> <p> I am facing the exact problem that you mentioned: Need to get my data from device to user space as efficiently as possible. I was wondering if you did find any example?<br> <p> Thanks<br> Bilal<br> <p> </div> Driver porting: Zero-copy user-space access http://lwn.net/Articles/248605/rss 2007-09-06T16:31:02+00:00 dnevil Try booting with a kernel parameter of "highmem=0".<br> Driver porting: Zero-copy user-space access http://lwn.net/Articles/248564/rss 2007-09-06T15:28:13+00:00 dnevil Sounds like your system is allocating memory from ZONE_HIGHMEM (since you are on a heavily loaded system, and you are probably running i386). The comments in include/linux/mm_types states that if page-&gt;virtual is null then the page is not mapped into kernel virtual memory (i.e. it is HIGHMEM). You should try allocating your memory as soon after system boot as possible. Are there other 'tricks' for assuring that user-allocated memory comes from ZONE_NORMAL or ZONE_DMA?<br> Driver porting: Zero-copy user-space access http://lwn.net/Articles/242359/rss 2007-07-20T12:43:48+00:00 bartjes As I am quite new with Linux, searching the entire morning to find a solution for getting data out of my driver to a user application as efficient as possible, I stumble accross deprecanted mechanisms, function prototypes, and sometimes even a bit of explanation.<br> All this looks very complex to me and I REALLY could use a basic example where a piece of shared memory is allocated, freed, passed from driver to user-spacve or vice versa, and how the driver fills information into the structure and how the user process can read this.<br> <p> It's sad that while searching all morning, an example is nowhere to be found, or it's way too complicated to understand, does compile with my terminal full of errors.....<br> <p> Any suggestion would be helpful, Thanks, Bart<br> Driver porting: Zero-copy user-space access http://lwn.net/Articles/236653/rss 2007-06-02T01:48:11+00:00 yltian Please "grep get_user_pages linux/drivers/media/video/video-buf.c". It's a good example. V4L2 uses this method to share memory betweent DMA and application.<br> Driver porting: Zero-copy user-space access http://lwn.net/Articles/172130/rss 2006-02-15T17:17:47+00:00 ceb Does anyone have any experience in using get_user_pages in a real system. As far as I can tell it is totally unreliable when the machine is in any way loaded. As well as getting zero addresses for pages returned, the physical addresses don't seem to correspond to the data to be transferred. This is on various flavors of Linux 2.6 based kernels. <br> <br> This seems to rule out performing DMA directly from user space but I would like to be told that I'm wrong. <br> <p> Driver porting: Zero-copy user-space access http://lwn.net/Articles/158185/rss 2005-11-02T21:29:42+00:00 rwbowman TRUE or FALSE - if I map and lock a user space buffer using get_user_pages during ioctl, and then allow the ioctl to return, the pages will remnain locked until I release them with page_cache_release. <br> <p> I've heard (twice now) where folks say they don't remain locked.?<br> Thanks!<br> <p> Driver porting: Zero-copy user-space access http://lwn.net/Articles/73943/rss 2004-03-03T07:55:24+00:00 bhepple Hmmm, a quick recursive grep through the 2.6.3 driver source and include files showed exactly 0 users of set_page_dirty_lock() and 1 user of put_page() (in drivers/char/agp/generic.c)<p>There _is_ a <br>#define page_cache_release(page) put_page(page)<br>in include/linux/pagemap.h and it is quite a popular little chap in the device driver code with 13 hits in the entire tree.<p>Am I missing something or should we be using page_cache_release instead of put_page and is it (and set_page_dirty_lock) _really_ needed after all - I can hardly believe all those drivers are causing &quot;data corruption and grumpy users&quot;...<p> Driver porting: Zero-copy user-space access http://lwn.net/Articles/71057/rss 2004-02-13T14:34:34+00:00 grisu1976 I don't really understand why the kiobuf interface does not exist anymore. In linux kernel 2.4 the kiobuf interface used get_user_pages, or am i wrong? The kiobuf interface was easier to use than get_user_pages - that's my opinion