Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: ddaney@caviumnetworks.com, msundius@cisco.com,
	linux-mips@linux-mips.org, dvomlehn@cisco.com,
	msundius@sundius.com
Subject: Re: memcpy and prefetch
Date: Thu, 29 Jan 2009 15:58:54 +0000	[thread overview]
Message-ID: <20090129155854.GC29521@linux-mips.org> (raw)
In-Reply-To: <20090129.213613.128618730.anemo@mba.ocn.ne.jp>

On Thu, Jan 29, 2009 at 09:36:13PM +0900, Atsushi Nemoto wrote:

> On Wed, 28 Jan 2009 18:30:47 +0000, Ralf Baechle <ralf@linux-mips.org> wrote:
> > --- a/arch/mips/lib/memcpy.S
> > +++ b/arch/mips/lib/memcpy.S
> > @@ -21,7 +21,7 @@
> >   * end of memory on some systems.  It's also a seriously bad idea on non
> >   * dma-coherent systems.
> >   */
> > -#if !defined(CONFIG_DMA_COHERENT) || !defined(CONFIG_DMA_IP27)
> > +#ifdef CONFIG_DMA_NONCOHERENT
> >  #undef CONFIG_CPU_HAS_PREFETCH
> >  #endif
> >  #ifdef CONFIG_MIPS_MALTA
> 
> This makes IP27 (and all other coherent platforms) use prefetch.  Is
> prefetch OK for all of them?
> 
> I suppose memcpy_fromio() should not use PREFETCH, at least.

The idea here is that we have two issues with prefetching:

 o Prefetching beyond the end of the source or destination range on a
   in-coherent range might bring back stale values from a DMA I/O
   buffer resulting in data corruption.  Hardware DMA coherency will
   avoid this issue.

 o IP27 has full blown hardware coherency.  Historically CONFIG_DMA_COHERENT
   was not able to cope with something of the complexity of IP27, so
   there was a separate CONFIG_DMA_IP27 and the broken logic expression
   was meant to treat CONFIG_DMA_COHERENT and CONFIG_DMA_IP27 the same
   as for prefetching.

 o Prefetching beyond the end of physical memory can cause exceptions on
   some systems.  The Malta has this problem.

Thus no prefetching on Malta or non-coherent systems.

  Ralf

  reply	other threads:[~2009-01-29 15:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27 23:00 memcpy and prefetch Michael Sundius
2009-01-27 23:07 ` David Daney
2009-01-28 10:37   ` Ralf Baechle
2009-01-28 15:28     ` Atsushi Nemoto
2009-01-28 18:30       ` Ralf Baechle
2009-01-29 12:36         ` Atsushi Nemoto
2009-01-29 15:58           ` Ralf Baechle [this message]
2009-01-30  3:39             ` David VomLehn (dvomlehn)
2009-01-30  3:39               ` David VomLehn (dvomlehn)
2009-02-04 21:27               ` Ralf Baechle
2009-02-04 21:27                 ` Ralf Baechle
2009-02-05 15:31                 ` Atsushi Nemoto
2009-01-28 19:28   ` Michael Sundius
2009-01-28 19:54     ` David Daney
2009-01-28 21:52       ` Chad Reese

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=20090129155854.GC29521@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=ddaney@caviumnetworks.com \
    --cc=dvomlehn@cisco.com \
    --cc=linux-mips@linux-mips.org \
    --cc=msundius@cisco.com \
    --cc=msundius@sundius.com \
    /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