From: Ralf Baechle <ralf@linux-mips.org>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: loody <miloody@gmail.com>,
Linux MIPS Mailing List <linux-mips@linux-mips.org>
Subject: Re: some question about wmb in mips
Date: Sun, 27 Jun 2010 21:52:06 +0100 [thread overview]
Message-ID: <20100627205206.GB4554@linux-mips.org> (raw)
In-Reply-To: <alpine.LFD.2.00.1006271745480.14683@eddie.linux-mips.org>
On Sun, Jun 27, 2010 at 06:47:14PM +0100, Maciej W. Rozycki wrote:
> > AFAIK, wmb in mips is implemented by calling sync,
>
> For platforms that support this instructions, yes.
For platforms that support this instruction _AND_ are not strongly ordered.
Iow we try to avoid it, if possible. Details are complicated.
> > wmb->fast_wmb->__sync, which makes sure Loads and stores executed
> > before the SYNC are completed before loads
> > and stores after the SYNC can start
>
> You shouldn't be relying on implementation details -- WMB is defined as a
> write ordering barrier only, so all the interface guarantees is any
> outstanding stores will be seen on the processor's bus interface before
> any future store starts. This is AFAIR the case with (at least some)
> platforms that do not have the SYNC instruction -- where any outstanding
> stores can still be delayed until after a future load.
>
> Actually with the recent introduction of the SYNC_WMB instruction it's
> likely it'll get used as the implementation of the WMB interface as soon
> as the distribution of the instruction is wide enough across platforms.
> As the name implies, this instruction only guarantees an ordering barrier
> for stores and not for loads.
>
> > But will this instruction write the cache back too?
>
> No, SYNC is only meaningful for uncached (and cached coherent) accesses.
> I think that's clear from how the instruction has been specified.
>
> > take usb example, it will call this maco before it let host processing
> > the commands on dram, so I wondering whether sync will write the cache
> > back to memory.
>
> You need to call the appropriate helper -- see the DMA API document for
> details. Or use a coherent (in the Linux sense) mapping, which in turn
> will make CPU-side memory accesses to this area uncached on non-coherent
> (in the MIPS sense) systems.
Ralf
next prev parent reply other threads:[~2010-06-28 2:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-27 16:16 some question about wmb in mips loody
2010-06-27 17:47 ` Maciej W. Rozycki
2010-06-27 20:52 ` Ralf Baechle [this message]
[not found] ` <AANLkTim53N4t7PXiRPNqtP0G9cEjMdQY77m73MVkApH5@mail.gmail.com>
2010-08-30 13:58 ` loody
2010-08-31 14:33 ` Ralf Baechle
2010-08-31 15:59 ` David Daney
2010-06-27 20:39 ` Ralf Baechle
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=20100627205206.GB4554@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=linux-mips@linux-mips.org \
--cc=macro@linux-mips.org \
--cc=miloody@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.