Re: [PATCH] generic device DMA (dma_pool update)

David Brownell
2003-01-03T05:50:22Z

Adam J. Richter wrote:

> The pci_pool_alloc in sa1111-buf.c is more interesting.
> alloc_safe_buffer is used to implement an unusual version of
> pci_map_single. It is unclear to me whether this approach is optimal.
> I'll look into this more.

Darn if I didn't mention SA1111 up front! Here's where avoiding
mapping APIs is a win, in favor of allocating dma buffers that
will work from the get go. (That is, dma_addr_t can usefully push
up the call stack, while gfp_flags pushes down.)

USB device drivers like "hid" and "usblp" do that already; later,
more drivers could convert.

Of course, the ohci-sa1111.c codepaths are also relevant here.
They use pci_pools for TD allocation. The fact that they use
SLAB_ATOMIC (you missed one!), and once didn't, bothers me;
luckily that became an easy fix a few months back.

And the dma_pool_patch I posted would make all this code morph
to using the slab allocator underneath. The slab code would be
smarter about managing it than pci_pool, so it'd be better at
sharing that 1 MByte of DMA memory with other devices.

- Dave