Re: Question: how to copy to user space from a tasklet

From: Arnd Bergmann
Date: Fri Oct 15 2010 - 05:00:09 EST


On Friday 15 October 2010 07:57:59 Stefan Richter wrote:
> Tom Brown wrote:
> > [Sorry to have to ask this here - I can't find any driver-specific
> > newsgroup or mailing lists - are there any??]
>
> linux-newbie perhaps.
>
> > I have a driver which needs to copy device data direct to user space
> > from a tasklet.
>
> One way would be to use mmap() to allocate the DMA buffer and insert it into
> the user address space before DMA commences. An additional poll/read/write
> based protocol or so can be used for buffer management during DMA.

Agreed, that would be best, it's a lot easier than the way Tom describes
the driver to work today.

Just for completeness: doing DMA to random user address would require the
process to register the area using some home grown interface, so that the
driver can do get_user_pages/kmap on all of them and subsequently pass
around an array of pages, while keeping track of ulimits and coherency
with the existing kernel mappings. Don't do that.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/