Messages in this thread | | | Date | Wed, 10 Sep 2008 23:39:00 +0900 | Subject | Re: [PATCH] x86: avoid unnecessary low zone allocation in AMD IOMMU's alloc_coherent | From | FUJITA Tomonori <> |
| |
On Wed, 10 Sep 2008 23:24:57 +0900 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> On Wed, 10 Sep 2008 15:53:47 +0200 > Joerg Roedel <joerg.roedel@amd.com> wrote: > > > On Wed, Sep 10, 2008 at 10:37:45PM +0900, FUJITA Tomonori wrote: > > > On Wed, 10 Sep 2008 15:10:32 +0200 > > > Joerg Roedel <joerg.roedel@amd.com> wrote: > > > > Can't we simply make the gfp hacks depend on > > > > dma_ops->is_phys and avoid further gfp hacks in the hardware iommu > > > > implementations? > > > > > > I thought about it but adding a new dma_ops->we_don't_want_gfp_flag > > > hook doesn't make the code simpler much. Currently, we have the gfp > > > setting hack in just one place. It's not bad. Adding such new hook > > > means adding more lines than we can remove. > > > > The is_phys flas is already in place and its meaning is "the dma_ops > > return bus addresses equal to physical addresses". This is exactly the > > case when we need the gfp hacks. So I don't see a problem in just > > skipping the gfp rewrite if is_phys is zero. I don't see a point in > > adding gfp flags in dma_alloc_coherent and remove them again > > dma_ops->alloc_coherent code. Specially in this case where we already > > know in dma_alloc_coherent if we really need the flag rewrite. > > dma_ops->is_phys doesn't work well for GART and Intel IOMMU, that do > virtual mappings for some devices and doesn't for some. > > We need to a hook that can pass a point to a device to IOMMUs like: > > dma_ops->is_phys(struct device *dev) > > > Because they need to look at a device to know if they will do virtual > mappings or not for it.
btw, in tip/x86/iommu, GART's alloc_coherent always does virtual mappings to allocate a size-aligned memory (as DMA-mapping.txt defines).
Because someone strongly insisted, I modified GART's alloc_coherent to do so but as I said again and again, it's completely meaningless (only POWER IOMMU does it and drivers don't depend on such requirement).
I guess that it would be better to do virtual mappings only when necessary as the current mainline does since GART I/O space is precious in some systems. But I don't care much. What's your opinion (as a AMD developer)?
| |