Re: PATCH: Raw device IO for 2.1.131

Leighton 9511380 Haynes (hayne-la@ee.uwa.edu.au)
Wed, 16 Dec 1998 14:17:35 +0800


On Wed, Dec 16, 1998 at 04:51:15AM +0000, Alan Cox wrote:
> > > HDTV chipsets want capture to DMA 1600x1200x24bit data to memory targets.
> > > The existing bttv sick 'vmalloc and look the other way' approach isnt as
> > > good as locking pages for this (Disk I/O issues aside)
> >
> > Umm.. That's what I said. You can lock down pages _easily_ in the page
> > cache. You just increment their usage count.
> >
> > And that has absolutely NOTHING to do with raw device access. What you do
> > is you make "sendfile()" work for the "copy to page cache" case too.
>
> Its only relevant because some of Stephens code also happens to do this. Im
> quite happy to consider the two items seperately. And we do need DMA to locked
> user pages (under kernel control!) for devices that generate a lot of data.
> As Ingo pointed out I can then DMA to an mmap and sendfile the result if
> I wish. This makes me happy.
>
I agree here, I'm currently working with some high speed network devices, which
will transmit data at the same speed as the PCI bus we're using. Currently, I
can see no sane way to transmit at the speed of the device. We can:
a) Not use dma transfer. This is bad, for the device we're using, this gives
a maximum transfer rate of 7mb/sec, as well as tying up the cpu.
b) Buffer on send. This causes significant slowdown, something like 30%
in out current version running at ~30mb/sec and more like 70% slower
on the final version.
c) Get your program to allocate special buffers of dma-able memory. This
gives nice transfer rates, but is not particularly versatile, and means
that you're tieing up a lot of memory all the time. Also allocating large
buffers of this type is difficult.
d) Use some sort of trick such as the rawio patch uses. I havent tested this
so i don't know how well it works. But it looks like it could give
reasonable performance and be versatile enough to be useful.

Now i don't particularly like any of these solutions. A zero-copy method of
getting data from user-space to a device is necessary (at least for me, and
probably for various other people, working with high-speed devices).
Now, i dont think this is a good way to do things, but i can't think of any
other way to do it. If anyone can enlighten me, i'd be grateful.

Leighton Haynes (Uni. of Western Australia)

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