Re: [PATCH] swiotlb: fix dma_alloc_coherent allocation failures with swiotlb

From: Joerg Roedel
Date: Thu Sep 04 2008 - 05:51:19 EST


On Thu, Sep 04, 2008 at 10:31:24AM +0200, Andi Kleen wrote:
> > Even if it's tree, only each IOMMU knows what's the best. That's the
> > point of these changes to remove the tricks in arch/x86/pci-dma.c and
> > let IOMMUs do what they want.
>
> Duplicating all the code. Sounds great.

Even greater is that hardware IOMMUs now don't pay the penalty of this
completly unnecessary alloc-free cycle in the generic dma_alloc_coherent
function and that now finally the driver specific free_coherent function
is called. And this all to the cost of minimal code duplication. If you
look into the patches you see that the old retry-loop is now in
pci-nommu.c where it belongs to. The GART also only needs small parts of
the old logic which are now in a specific alloc_coherent function for
this driver.

> > > Also there's usually the problem that not all busses are translated,
> > > e.g. Calgary used to do that so for e.g. dev == NULL allocations you had
> > > to use these fallback algorithms anyways.
> >
> > dev == NULL isn't a minor thing. It's just using the fallback
> > device.
>
> You still have to handle it fully.

Thats why the handling of dev == NULL is still in the dma_alloc_coherent
function and should also stay there.

Joerg

--
| AMD Saxony Limited Liability Company & Co. KG
Operating | Wilschdorfer Landstr. 101, 01109 Dresden, Germany
System | Register Court Dresden: HRA 4896
Research | General Partner authorized to represent:
Center | AMD Saxony LLC (Wilmington, Delaware, US)
| General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy

--
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/