From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
David Miller <davem@davemloft.net>,
jeff@garzik.org, paulus@samba.org, torvalds@osdl.org,
linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: Opinion on ordering of writel vs. stores to RAM
Date: Mon, 11 Sep 2006 10:12:11 +1000 [thread overview]
Message-ID: <1157933531.31071.274.camel@localhost.localdomain> (raw)
In-Reply-To: <0F623199-9152-46B3-8CC3-6FFCDD8AF705@kernel.crashing.org>
Ok, so we have two different proposals here...
Maybe we should cast a vote ? :)
* Option A:
- writel/readl are fully synchronous (minus mmiowb for spinlocks)
- we provide __writel/__readl with some barriers with relaxed ordering
between memory and MMIO (though still _precise_ semantics, not arch
specific)
* Option B:
- The driver decides at ioremap time wether it wants a fully ordered
mapping or not using
a "special" version of ioremap (with flags ?)
- writel/readl() behave differently depending on the mapping
- __writel/__readl might exist but are architecture specific (ahem...
still to be debated)
The former seems easier to me to implement. The later might indeed be a
bit easier for drivers writers, I'm not 100% convinced tho. The later
means stuffing special tokens in the returned address from ioremap and
testing for them in writel. However, the later is also what we need for
write combining (at least for PowerPC, maybe for other archs, wether a
mapping can write combine has to be decided by using flags in the page
table, thus has to be done at ioremap time. (*)
Votes ?
(*) Unrelated note about write combine: Due to weird implementation
issues, one cannot guarantee to prevent write combine on a write-combine
enabled mapping using barriers. This doesn't work due to CPUs combining
stores between threads on such mappings. I know of at least one CPU
doing that (Cell), there might be a lot more though. Thus a driver using
write combine might want to create two mappings for it's IOs, one with
combine enabled, one ordered, and use the "right" one depending on the
requirements of a given IO access.
> The tg3 bug actually seems not to be because of the missing wmb()'s,
> [the driver and all net traffic survive just fine in the case of non-
> TSO],
> but just because of a plain-and-simple programming bug in the driver.
> I'll run some tests tomorrow to confirm. If I'm right, this fix should
> go into .18 and into .17-stable at least.
Interesting :) I didn't actually verify the barrier problem theory
(though the driver does indeed seem to lack them, so there _is_ a
problem there too), I trusted Michael Chan who seemed to know about the
bug :) Anyway, that doesn't change anything to the fact that there is a
problem with barriers and we are on a good path to finally do something
sane about it.
> Of course the problems that the PowerPC port currently has with the
> missing wmb()'s are still there, but in the non-TSO case they almost
> always result in 100% garbage sent on the actual ethernet line, and
> that doesn't impede correctness (and it has been there since about
> forever; even the TSO case that _does_ corrupt data was in the released
> 2.6.17, it's very hard to hit). There's no reason to delay 2.6.18
> release or change the PowerPC I/O accessors because of this single
> issue, knowing it was in 2.6.17 already.
We can add the missing barriers to tg3 for 2.6.18 nontheless.
> That "trick" to avoid I/O accesses to "leak out" of protected regions
> is just fine, and should be done no matter what -- if it is decreed that
> spinlocks order I/O accesses at all, which is not a bad idea at all (in
> my opinion anyway).
Or we rely on an explicit barrier for that, which is what mmiowb() has
been defined for. We can use the "trick" to detect the missing ones
though, as a debugging aid.
Ben.
next prev parent reply other threads:[~2006-09-11 0:12 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-09 2:03 Opinion on ordering of writel vs. stores to RAM Paul Mackerras
2006-09-09 2:42 ` Linus Torvalds
2006-09-09 3:02 ` Paul Mackerras
2006-09-09 3:54 ` Linus Torvalds
2006-09-09 7:24 ` Benjamin Herrenschmidt
2006-09-09 9:34 ` David Miller
2006-09-09 9:55 ` Jeff Garzik
2006-09-09 10:08 ` David Miller
2006-09-10 17:18 ` Jesse Barnes
2006-09-10 19:35 ` Alan Cox
2006-09-10 21:25 ` Benjamin Herrenschmidt
2006-09-10 22:23 ` Alan Cox
2006-09-10 22:18 ` Benjamin Herrenschmidt
2006-09-11 13:19 ` Jes Sorensen
2006-09-10 23:35 ` Segher Boessenkool
2006-09-11 0:12 ` Benjamin Herrenschmidt [this message]
2006-09-11 0:34 ` Jesse Barnes
2006-09-11 1:04 ` Benjamin Herrenschmidt
2006-09-11 1:13 ` Segher Boessenkool
2006-09-11 1:35 ` Benjamin Herrenschmidt
2006-09-11 9:02 ` Alan Cox
2006-09-11 9:23 ` Benjamin Herrenschmidt
2006-09-11 0:25 ` Jesse Barnes
2006-09-11 0:54 ` Segher Boessenkool
2006-09-11 1:10 ` Benjamin Herrenschmidt
2006-09-11 1:48 ` Segher Boessenkool
2006-09-11 3:53 ` Benjamin Herrenschmidt
2006-09-11 18:12 ` Jesse Barnes
2006-09-11 1:00 ` Benjamin Herrenschmidt
2006-09-11 18:08 ` Jesse Barnes
2006-09-11 21:32 ` Benjamin Herrenschmidt
2006-09-10 20:01 ` Segher Boessenkool
2006-09-11 13:21 ` David Miller
2006-09-11 14:17 ` Segher Boessenkool
2006-09-12 0:32 ` David Miller
2006-09-12 0:49 ` Benjamin Herrenschmidt
2006-09-12 16:47 ` Segher Boessenkool
2006-09-12 0:54 ` Roland Dreier
2006-09-09 11:16 ` Paul Mackerras
2006-09-09 7:23 ` Benjamin Herrenschmidt
2006-09-09 9:38 ` David Miller
2006-09-09 15:09 ` Alan Cox
2006-09-10 17:19 ` Jesse Barnes
2006-09-10 17:35 ` Michael Buesch
2006-09-10 17:49 ` Linus Torvalds
2006-09-10 18:02 ` Michael Buesch
2006-09-09 15:08 ` Alan Cox
2006-09-09 18:34 ` Auke Kok
2006-09-09 19:10 ` Patrick McFarland
2006-09-09 15:06 ` Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2006-09-11 5:03 Michael Chan
2006-09-11 5:21 ` Benjamin Herrenschmidt
2006-09-12 4:30 Albert Cahalan
2006-09-12 5:30 ` Benjamin Herrenschmidt
2006-09-12 6:04 ` Albert Cahalan
2006-09-12 6:12 ` Benjamin Herrenschmidt
2006-09-12 7:09 ` Albert Cahalan
2006-09-12 7:17 ` Benjamin Herrenschmidt
2006-09-12 7:21 ` Albert Cahalan
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=1157933531.31071.274.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davem@davemloft.net \
--cc=jbarnes@virtuousgeek.org \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=segher@kernel.crashing.org \
--cc=torvalds@osdl.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