mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: joro@8bytes.org, tsbogend@alpha.franken.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Fix dma_mapping_error for 32bit x86
Date: Mon, 1 Dec 2008 20:36:56 +0100	[thread overview]
Message-ID: <20081201193656.GB17250@elte.hu> (raw)
In-Reply-To: <20081202021638K.fujita.tomonori@lab.ntt.co.jp>


* FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:

> On Mon, 1 Dec 2008 15:35:34 +0100
> Ingo Molnar <mingo@elte.hu> wrote:
> 
> > 
> > * FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> > 
> > > On Mon, 1 Dec 2008 13:55:01 +0100
> > > Ingo Molnar <mingo@elte.hu> wrote:
> > > 
> > > > 
> > > > * FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> > > > 
> > > > > On Mon, 1 Dec 2008 12:34:51 +0100
> > > > > Joerg Roedel <joro@8bytes.org> wrote:
> > > > > 
> > > > > > On Sat, Nov 29, 2008 at 01:46:27PM +0100, Thomas Bogendoerfer wrote:
> > > > > > > Devices like b44 ethernet can't dma from addresses above 1GB. The driver
> > > > > > > handles this cases by falling back to GFP_DMA allocation. But for detecting
> > > > > > > the problem it needs to get an indication from dma_mapping_error.
> > > > > > > The bug is triggered by using a VMSPLIT option of 2G/2G.
> > > > > > 
> > > > > > Looks like your system uses swiotlb as the dma_ops backend. Its the only
> > > > > > implementation providing the ops->mapping_error callback and does not
> > > > > > use bad_dma_address as the error value.
> > > > > 
> > > > > I think that you misunderstand the problem.
> > > > > 
> > > > > He uses X86_32 so swiotlb should not be used (which is available on 
> > > > > only X86_64 and IA64 for now).
> > > > > 
> > > > > b44 needs an address under 1GB so it sets device->dma_mask to 
> > > > > DMA_30BIT_MASK. With VMSPLIT option of 2G/2G, I guess that b44 could 
> > > > > get addresses above 1GB from the networking subsystem. In such case, 
> > > > > nommu_map_single returns bad_dma_address properly, but on X86_32, 
> > > > > dma_mapping_error always returns 0 (success). So b44 wrongly thinks 
> > > > > that the address is under 1GB.
> > > > > 
> > > > > This patch fixes dma_mapping_error() to check a passed address
> > > > > properly (compares it with bad_dma_address).
> > > > > 
> > > > > As I already wrote, the current git needs a patch modified slightly:
> > > > > 
> > > > > http://marc.info/?l=linux-kernel&m=122797163405377&w=2
> > > > 
> > > > i have i queued up in x86/urgent, see below.
> > > 
> > > As I wrote, just removing #ifdef is better since:
> > > 
> > > 1) Xen people want swiotlb on X86_32. swiotlb uses ops->mapping_error
> > > so X86_32 also needs to check ops->mapping_error.
> > > 
> > > 2) Removing #ifdef hack is always good.
> > > 
> > > 
> > > But this patch fixes the bug and it works for now. And I think that 
> > > Thomas tested it. So it's fine to commit this patch by me.
> > 
> > yeah, i included the tested patch.
> > 
> > > I'll send a patch to remove the ifdef on the top of this patch after 
> > > this patch goes into mainline.
> > 
> > sure - or you can send it against tip/master straight away.
> 
> Ok, here you are.
> 
> Note that this is for 2.6.29 (not 2.6.28).

thanks, applied to tip/x86/iommu.

	Ingo

  reply	other threads:[~2008-12-01 19:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-29 12:46 Thomas Bogendoerfer
2008-11-29 15:13 ` FUJITA Tomonori
2008-12-01 11:34 ` Joerg Roedel
2008-12-01 12:01   ` FUJITA Tomonori
2008-12-01 12:55     ` Ingo Molnar
2008-12-01 14:10       ` FUJITA Tomonori
2008-12-01 14:35         ` Ingo Molnar
2008-12-01 17:17           ` FUJITA Tomonori
2008-12-01 19:36             ` Ingo Molnar [this message]
2008-12-01 12:58     ` Joerg Roedel
2008-12-01 14:10       ` FUJITA Tomonori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081201193656.GB17250@elte.hu \
    --to=mingo@elte.hu \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®