linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: linuxppc-embedded@lists.linuxppc.org
Subject: Re: Workaround for USB DMA bugs
Date: Thu, 4 Apr 2002 09:40:51 +1000	[thread overview]
Message-ID: <20020403234051.GG21034@zax> (raw)
In-Reply-To: <3CAB3F0B.8080700@embeddededge.com>


On Wed, Apr 03, 2002 at 12:42:35PM -0500, Dan Malek wrote:
>
> David Gibson wrote:
>
> >Well, I'm not sure I'd want to pollute the tree with this sort of
> >hack, but on the other hand it makes things work that wouldn't
> >otherwise.
>
> This has been floating around for a long time while we were searching
> for the proper solution.  As you said, if you want things to work, you
> have to do this.  This still isn't logically correct, it just makes
> the window of error smaller.

I'm well aware of that.  In fact I think for most cases in the USB
stack it is safe because the buffers in question are quite a long way
up the stack by the time the DMA is initiated, and the code waits for
the transfer to complete before it pops enough stack frames to touch
this area.  Nonetheless it's certainly a hack and a workaround, not a
solution.

> This is one of several problems in the Linux kernel that has to be
> solved for processors that don't have bus snooping.  All we have been
> doing over time is making the problems less apparent, not solving them.
> There are similar hacks for DMA into sk buffers, which still doesn't
> work in forwarding/bridging applications (you won't notice the bugs
> in endpoint only situations).

Indeed, and the USB people realise that.  Well, amongst other things.
DMA buffers on the stack have other problems as well (I believe the
stack isn't guaranteed physically contiguous on all architectures).

> The real problem to be solved is any memory object that can be the target
> for DMA has to be cache line aligned, and modulo cache line size for
> incoherent processors.  Since few people work with this type of processor,
> it is hard to get maintainers interested in making these general changes
> (and polluting the Linux kernel with knowledge of cache line size).

It's becoming easier though, with the __cacheline_aligned macro.  Plus
I think if the buffer is individually kmalloc()ed it will be properly
aligned.

--
David Gibson			| For every complex problem there is a
david@gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.  -- H.L. Mencken
http://www.ozlabs.org/people/dgibson


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

  reply	other threads:[~2002-04-03 23:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-03  2:43 Workaround for USB DMA bugs David Gibson
2002-04-03  8:17 ` Armin
2002-04-03 17:39   ` Frank Rowand
2002-04-03 17:49   ` Dan Malek
2002-04-03 20:43     ` David Blythe
2002-04-03 23:34       ` David Gibson
2002-04-03  9:45 ` "David Müller (ELSOFT AG)"
2002-04-03 23:35   ` David Gibson
2002-04-03 17:42 ` Dan Malek
2002-04-03 23:40   ` David Gibson [this message]
2002-04-04  2:54     ` Dan Malek
2002-04-04  3:48       ` David Gibson
2002-04-04  4:09         ` Dan Malek
2002-04-04  5:23           ` David Gibson
2002-04-04  6:08             ` Dan Malek
2002-04-04  6:30               ` David Gibson
2002-04-04 20:21                 ` David Blythe
2002-04-04 12:35       ` Brad Parker
2002-04-04 14:12         ` Dan Malek
  -- strict thread matches above, loose matches on Subject: below --
2002-04-04  4:19 Jeremy Rosen
2002-04-04  6:16 ` Dan Malek
2002-04-04  6:32   ` David Gibson
2002-04-04  6:40 Rosen Jeremy
2002-04-04  6:52 ` David Gibson

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=20020403234051.GG21034@zax \
    --to=david@gibson.dropbear.id.au \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /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;
as well as URLs for NNTP newsgroup(s).