Re: [2.6.27-rc6, patch] fix SWIOTLB oops...

From: FUJITA Tomonori
Date: Sat Sep 13 2008 - 14:48:33 EST


On Sat, 13 Sep 2008 18:53:13 +0100
"Daniel J Blueman" <daniel.blueman@xxxxxxxxx> wrote:

> >> Fix back-off path when memory allocation fails
> >> Signed-off-by: Daniel J Blueman <daniel.blueman@xxxxxxxxx>
> >>
> >> diff --git a/lib/swiotlb.c b/lib/swiotlb.c
> >> index 977edbd..8826fdf 100644
> >> --- a/lib/swiotlb.c
> >> +++ b/lib/swiotlb.c
> >> @@ -491,7 +491,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
> >> * the lowest available address range.
> >> */
> >> dma_addr_t handle;
> >> - handle = swiotlb_map_single(NULL, NULL, size, DMA_FROM_DEVICE);
> >> + handle = swiotlb_map_single(hwdev, NULL, size, DMA_FROM_DEVICE);
> >
> > I think that it's better to use map_single instead of
> > swiotlb_map_single since we always need swiotlb memory here.
> >
> > http://www.uwsg.iu.edu/hypermail/linux/kernel/0809.1/0043.html
>
> Thanks Fujita; this looks a better way of doing this. I've tested the
> three patches you posted and they address the original issue I bumped
> into, so seem an appropriate fix for -rc7. Not sure if preceding
> comments need tweaking though.
>
> Our work isn't done yet though, since we see unexpected page state [5]
> on the release path. Calling the appropriate IOMMU/SWIOTLB release
> function [6] corrects this. Verified on x86-64 Intel system with
> SWIOTLB in use due to large memory; without this, processes end up
> hosed, so I'd say it's -rc7 material.

Are you sure your patch doesn't break other x86 IOMMU implementations
(note that this patch affects all the IOMMUs)?

x86 IOMMU coherent code has been broken for a long time. The coherent
code was completely rewritten for 2.6.28 to fix all the issues.

git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip.git

I think it's too late to try to fix v2.6.27.
--
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/