[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080904125716R.fujita.tomonori@lab.ntt.co.jp>
Date: Thu, 4 Sep 2008 13:11:35 +0900
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To: joro@...tes.org
Cc: fujita.tomonori@....ntt.co.jp, joerg.roedel@....com,
tony.luck@...el.com, linux-kernel@...r.kernel.org,
iommu@...ts.linux-foundation.org, mingo@...hat.com, hpa@...or.com,
tglx@...utronix.de, kamezawa.hiroyu@...fujitsu.com
Subject: Re: [PATCH] swiotlb: fix dma_alloc_coherent allocation failures
with swiotlb
On Wed, 3 Sep 2008 21:54:15 +0200
Joerg Roedel <joro@...tes.org> wrote:
> On Thu, Sep 04, 2008 at 03:05:21AM +0900, FUJITA Tomonori wrote:
> > On Wed, 3 Sep 2008 17:03:44 +0200
> > Joerg Roedel <joerg.roedel@....com> wrote:
> >
> > > The SWIOTLB version of dma_alloc_coherent allocates all memory with
> > > GFP_DMA unconditionally. This leads sometimes unnecessary to allocation
> > > failures. This patch makes the allocation strategy to use the DMA32 zone
> > > first if this is possible. The changes are boot tested on AMD64 and
> > > compile tested for i386 and IA64.
> > >
> > > Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
> > > Cc: tony.luck@...el.com
> > > Signed-off-by: Joerg Roedel <joerg.roedel@....com>
> > > ---
> > > lib/swiotlb.c | 23 +++++++++++++++++------
> > > 1 files changed, 17 insertions(+), 6 deletions(-)
> >
> > This doesn't look correct since IA64 doesn't need this flag hack.
>
> Thats why the patch checks the DMA mask against ISA_DMA_THRESHOLD. This
> is defined as the border of the ZONE_DMA (16MB on x86 and 4G on IA64).
> So is correct for x86 and ia64.
You try to bring back the tricks used in arch/x86/kernel/pci-dma.c to
lib/swiotlb.c. I believe that they should be in
arch/x86/kernel/pci-swiotlb.c.
> > Another problem about this patch is that swiotlb doesn't use GFP_DMA
> > for the fallback_dev.
>
> Thats not true, it does. ISA_DMA_THRESHOLD is defined to be the same as
> DMA_24BIT_MASK, which is the DMA mask of the fallback_dev.
I don't think so. device x86_dma_fallback_dev is defined as (in
tip/master):
struct device x86_dma_fallback_dev = {
.bus_id = "fallback device",
.coherent_dma_mask = DMA_32BIT_MASK,
.dma_mask = &x86_dma_fallback_dev.coherent_dma_mask,
};
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists