2011-03-29 11:25:07

by Stas Sergeev

[permalink] [raw]
Subject: vmsplice from mmapped DMA buffer

Hi.

I'm trying to use vmsplice() to speed up the transfer
from the mmapped DMA buffer, and read it by another process.
As it seems to me, right now this is not really possible:
if the pipe reader lags, the DMA will overwrite the pages
that were not yet transferred. And I can't pause the DMA,
because it transfers the incoming realtime data stream.
So right now I am using the classic read/write, but that's
a huge CPU load.
Is there any way to achieve the reliable results with vmsplice?

If right now vmsplice cannot be reliably used to transfer
from the non-pausible DMA buffer, then I can think of the
following extensions (flags) to it:
- VMSPLICE_F_QUERY_PENDING: returns the number of bytes
still pending for IO, within the specified memory areas.
- VMSPLICE_F_VACATE: vacate the specified memory areas
from the pending IO, if any. By copying the pending data to the
kernel buffer.
- VMSPLICE_F_FLUSH: block until there is no more pending
IO for the specified memory areas.
- VMSPLICE_F_ASYNC: give SIGIO when the specified memory
areas are completely xferred and consumed by the reader.

Well, this flags will not play well with the existing vmsplice(),
so basically this is a brain-storming.
Anyway, are there any suggestions about vmsplicing from
the DMA buffer? Or, if not yet possible - what have to be done
to get there?