public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: David Miller <davem@davemloft.net>,
	jeff@garzik.org, paulus@samba.org, torvalds@osdl.org,
	linux-kernel@vger.kernel.org, benh@kernel.crashing.org,
	akpm@osdl.org
Subject: Re: Opinion on ordering of writel vs. stores to RAM
Date: Sun, 10 Sep 2006 22:01:20 +0200	[thread overview]
Message-ID: <D680AFCF-11EC-48AD-BBC2-B92521DF442A@kernel.crashing.org> (raw)
In-Reply-To: <200609101018.06930.jbarnes@virtuousgeek.org>

>>> As (I think) BenH mentioned in another email, the normal way Linux
>>> handles these interfaces is for the primary API (readX, writeX) to
>>> be strongly ordered, strongly coherent, etc.  And then there is a
>>> relaxed version without barriers and syncs, for the smart guys who
>>> know what they're doing
>>
>> Indeed, I think that is the way to handle this.
>
> Well why didn't you guys mention this when mmiowb() went in?
>
> I agree that having a relaxed PIO ordering version of writeX makes  
> sense
> (jejb convinced me of this on irc the other day).  But what to name  
> it?
> We already have readX_relaxed, but that's for PIO vs. DMA ordering,  
> not
> PIO vs. PIO.  To distinguish from that case maybe writeX_weak or
> writeX_nobarrier would make sense?

Why not just keep writel() etc. for *both* purposes; the address cookie
it gets as input can distinguish between the required behaviours for
different kinds of I/Os; it will have to be setup by the arch-specific
__ioremap() or similar.  And then there could be a  
pci_map_mmio_relaxed()
that, when a driver uses it, means "this driver requires only PCI
ordering rules for its MMIO, not x86 rules", so the driver promises to
do wmb()'s for DMA ordering and the mmiowb() [or whatever they become --
pci_mem_to_dma_barrier() and pci_cpu_to_cpu_barrier() or whatever] etc.

Archs that don't see the point in doing (much) faster and scalable I/O,
or just don't want to bother, can have this pci_map_mmio() just call
their x86-ordering ioremap() stuff.

The impact on architectures is minimal; they all need to implement this
new mapping function, but can just default it if they don't (yet) want
to take advantage of it.  Archs that do care need to use the I/O cookie
as an actual cookie, not directly as a CPU address to write to, and then
use the proper ordering stuff for the kind of ordering the cookie says
is needed for this I/O range.

The impact on device drivers is even more minimal; drivers don't have to
change; and if they don't, they get x86 I/O ordering semantics.  Drivers
that do want to be faster on other architectures, and have been  
converted
for it (and most interesting ones have), just need to change the  
ioremap()
of their MMIO space to the new API.

I hope this way everyone can be happy -- no one is forced to change,  
only
one new API is introduced.


Segher


  parent reply	other threads:[~2006-09-10 20:02 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
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 [this message]
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=D680AFCF-11EC-48AD-BBC2-B92521DF442A@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=jbarnes@virtuousgeek.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.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