From: Brent Casavant <bcasavan@sgi.com>
To: Nick Piggin <npiggin@suse.de>
Cc: linuxppc-dev@ozlabs.org, linux-ia64@vger.kernel.org
Subject: Re: wmb vs mmiowb
Date: Tue, 28 Aug 2007 20:56:28 +0000 [thread overview]
Message-ID: <20070828151737.P5403@pkunk.americas.sgi.com> (raw)
In-Reply-To: <20070824030904.GC6989@wotan.suse.de>
On Fri, 24 Aug 2007, Nick Piggin wrote:
> And all platforms other than sn2 don't appear to reorder IOs after
> they leave the CPU, so only sn2 needs to do the mmiowb thing before
> spin_unlock.
I'm sure all of the following is already known to most readers, but
I thought the paragraph above might potentially cause confusion as
to the nature of the problem mmiowb() is solving on SN2. So for
the record...
SN2 does not reorder IOs issued from a single CPU (that would be
insane). Neither does it reorder IOs once they've reached the IO
fabric (equally insane). From an individual CPU's perspective, all
IOs that it issues to a device will arrive at that device in program
order.
(In this entire message, all IOs are assumed to be memory-mapped.)
The problem mmiowb() helps solve on SN2 is the ordering of IOs issued
from multiple CPUs to a single device. That ordering is undefined, as
IO transactions are not ordered across CPUs. That is, if CPU A issues
an IO at time T, and CPU B at time T+1, CPU B's IO may arrive at the
IO fabric before CPU A's IO, particularly if CPU B happens to be closer
than CPU B to the target IO bridge on the NUMA network.
The simplistic method to solve this is a lock around the section
issuing IOs, thereby ensuring serialization of access to the IO
device. However, as SN2 does not enforce an ordering between normal
memory transactions and memory-mapped IO transactions, you cannot
be sure that an IO transaction will arrive at the IO fabric "on the
correct side" of the unlock memory transaction using this scheme.
Enter mmiowb().
mmiowb() causes SN2 to drain the pending IOs from the current CPU's
node. Once the IOs are drained the CPU can safely unlock a normal
memory based lock without fear of the unlock's memory write passing
any outstanding IOs from that CPU.
Brent
--
Brent Casavant All music is folk music. I ain't
bcasavan@sgi.com never heard a horse sing a song.
Silicon Graphics, Inc. -- Louis Armstrong
next prev parent reply other threads:[~2007-08-28 20:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-22 4:57 wmb vs mmiowb Nick Piggin
2007-08-22 18:07 ` Linus Torvalds
2007-08-22 19:02 ` Jesse Barnes
2007-08-23 2:20 ` Nick Piggin
2007-08-23 2:57 ` Linus Torvalds
2007-08-23 3:54 ` Nick Piggin
2007-08-23 16:14 ` Linus Torvalds
2007-08-23 4:20 ` Nick Piggin
2007-08-23 16:16 ` Linus Torvalds
2007-08-23 16:27 ` Benjamin Herrenschmidt
2007-08-24 3:09 ` Nick Piggin
2007-08-28 20:56 ` Brent Casavant [this message]
2007-08-29 0:59 ` Nick Piggin
2007-08-29 18:53 ` Brent Casavant
2007-08-30 3:36 ` Nick Piggin
2007-08-30 19:42 ` Brent Casavant
2007-09-03 20:48 ` Nick Piggin
2007-08-24 2:59 ` Nick Piggin
2007-08-23 17:02 ` Jesse Barnes
2007-08-23 1:59 ` Nick Piggin
2007-08-23 7:27 ` Benjamin Herrenschmidt
2007-08-23 16:56 ` Jesse Barnes
2007-08-24 3:12 ` Nick Piggin
2007-08-28 21:21 ` Brent Casavant
2007-08-28 23:01 ` Peter Chubb
2007-08-23 7:25 ` Benjamin Herrenschmidt
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=20070828151737.P5403@pkunk.americas.sgi.com \
--to=bcasavan@sgi.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=npiggin@suse.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