All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/17] Cross-architecture definitions of relaxed MMIO accessors
@ 2014-09-24 17:17 Will Deacon
  2014-09-24 17:17 ` [PATCH v3 01/17] asm-generic: io: implement relaxed accessor macros as conditional wrappers Will Deacon
                   ` (18 more replies)
  0 siblings, 19 replies; 80+ messages in thread
From: Will Deacon @ 2014-09-24 17:17 UTC (permalink / raw)
  To: linux-arch, linux-kernel
  Cc: arnd, benh, chris, cmetcalf, davem, deller, dhowells, geert,
	heiko.carstens, hpa, jcmvbkbc, jesper.nilsson, mingo, monstr,
	paulmck, rdunlap, sam, schwidefsky, starvik, takata, tglx,
	tony.luck, daniel.thompson, broonie, linux, Will Deacon

Hello everybody,

This is version three of the series I've originally posted here:

  v1: https://lkml.org/lkml/2014/4/17/269
  v2: https://lkml.org/lkml/2014/5/22/468

This is basically just a rebase on top of 3.17-rc6, minus the alpha patch
(which was merged into mainline).

I looked at reworking the non-relaxed accessors to imply mmiowb, but it
quickly got messy as some architectures (e.g. mips) deliberately keep
mmiowb and readX/writeX separate whilst others (e.g. powerpc) don't trust
drivers to get mmiowb correct, so add barriers to both. Given that
arm/arm64/x86 don't care about mmiowb, I've left that as an exercise for
an architecture that does care.

In order to get this lot merged, we probably want to merge the asm-generic
patch (1/17) first, so Acks would be much appreciated on the architecture
bits.

As before, I've included the original cover letter below, as that describes
what I'm trying to do in more detail.

Thanks,

Will

--->8

This RFC series attempts to define a portable (i.e. cross-architecture)
definition of the {readX,writeX}_relaxed MMIO accessor functions. These
functions are already in widespread use amongst drivers (mainly those supporting
devices embedded in ARM SoCs), but lack any well-defined semantics and,
subsequently, any portable definitions to allow these drivers to be compiled for
other architectures.

The two main motivations for this series are:

 (1) To promote use of the _relaxed MMIO accessors on weakly-ordered
     architectures, where they can bring significant performance improvements
     over their non-relaxed counterparts.

 (2) To allow COMPILE_TEST to build drivers using the relaxed accessors across
     all architectures.

The proposed semantics largely match exactly those provided by the ARM
implementation (i.e. no weaker), with one exception (see below).

Informally:

  - Relaxed accesses to the same device are ordered with respect to each other.

  - Relaxed accesses are *not* guaranteed to be ordered with respect to normal
    memory accesses (e.g. DMA buffers -- this is what gives us the performance
    boost over the non-relaxed versions).

  - Relaxed accesses are not guaranteed to be ordered with respect to
    LOCK/UNLOCK operations.

In actual fact, the relaxed accessors *are* ordered with respect to LOCK/UNLOCK
operations on ARM[64], but I have added this constraint for the benefit of
PowerPC, which has expensive I/O barriers in the spin_unlock path for the
non-relaxed accessors.

A corollary to this is that mmiowb() probably needs rethinking. As it currently
stands, an mmiowb() is required to order MMIO writes to a device from multiple
CPUs, even if that device is protected by a lock. However, this isn't often used
in practice, leading to PowerPC implementing both mmiowb() *and* synchronising
I/O in spin_unlock.

I would propose making the non-relaxed I/O accessors ordered with respect to
LOCK/UNLOCK, leaving mmiowb() to be used with the relaxed accessors, if
required, but would welcome thoughts/suggestions on this topic.


Will Deacon (17):
  asm-generic: io: implement relaxed accessor macros as conditional
    wrappers
  microblaze: io: remove dummy relaxed accessor macros
  s390: io: remove dummy relaxed accessor macros for reads
  xtensa: io: remove dummy relaxed accessor macros for reads
  frv: io: implement dummy relaxed accessor macros for writes
  cris: io: implement dummy relaxed accessor macros for writes
  ia64: io: implement dummy relaxed accessor macros for writes
  m32r: io: implement dummy relaxed accessor macros for writes
  m68k: io: implement dummy relaxed accessor macros for writes
  mn10300: io: implement dummy relaxed accessor macros for writes
  parisc: io: implement dummy relaxed accessor macros for writes
  powerpc: io: implement dummy relaxed accessor macros for writes
  sparc: io: implement dummy relaxed accessor macros for writes
  tile: io: implement dummy relaxed accessor macros for writes
  x86: io: implement dummy relaxed accessor macros for writes
  documentation: memory-barriers: clarify relaxed io accessor semantics
  asm-generic: io: define relaxed accessor macros unconditionally

 Documentation/memory-barriers.txt | 13 +++++++++----
 arch/cris/include/asm/io.h        |  3 +++
 arch/frv/include/asm/io.h         |  3 +++
 arch/ia64/include/asm/io.h        |  4 ++++
 arch/m32r/include/asm/io.h        |  3 +++
 arch/m68k/include/asm/io.h        |  8 ++++++++
 arch/m68k/include/asm/io_no.h     |  4 ----
 arch/microblaze/include/asm/io.h  |  8 --------
 arch/mn10300/include/asm/io.h     |  4 ++++
 arch/parisc/include/asm/io.h      | 12 ++++++++----
 arch/powerpc/include/asm/io.h     | 12 ++++++++----
 arch/s390/include/asm/io.h        |  5 -----
 arch/sparc/include/asm/io.h       |  9 +++++++++
 arch/sparc/include/asm/io_32.h    |  4 ----
 arch/sparc/include/asm/io_64.h    |  8 ++------
 arch/tile/include/asm/io.h        |  4 ++++
 arch/x86/include/asm/io.h         |  4 ++++
 arch/xtensa/include/asm/io.h      |  7 -------
 include/asm-generic/io.h          | 10 ++++++++++
 19 files changed, 79 insertions(+), 46 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 80+ messages in thread

end of thread, other threads:[~2014-10-31 11:10 UTC | newest]

Thread overview: 80+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-24 17:17 [PATCH v3 00/17] Cross-architecture definitions of relaxed MMIO accessors Will Deacon
2014-09-24 17:17 ` [PATCH v3 01/17] asm-generic: io: implement relaxed accessor macros as conditional wrappers Will Deacon
2014-09-25 10:32   ` Arnd Bergmann
2014-09-25 10:38     ` Will Deacon
2014-09-25 10:38       ` Will Deacon
2014-09-25 10:43       ` Arnd Bergmann
2014-09-25 10:43         ` Arnd Bergmann
2014-09-25 11:44         ` Will Deacon
2014-09-25 11:44           ` Will Deacon
2014-09-24 17:17 ` [PATCH v3 02/17] microblaze: io: remove dummy relaxed accessor macros Will Deacon
2014-09-24 17:17 ` [PATCH v3 03/17] s390: io: remove dummy relaxed accessor macros for reads Will Deacon
2014-09-24 17:17 ` [PATCH v3 04/17] xtensa: " Will Deacon
2014-09-25 15:22   ` Max Filippov
2014-09-25 15:22     ` Max Filippov
2014-09-24 17:17 ` [PATCH v3 05/17] frv: io: implement dummy relaxed accessor macros for writes Will Deacon
2014-09-24 17:17 ` [PATCH v3 06/17] cris: " Will Deacon
2014-09-24 17:17 ` [PATCH v3 07/17] ia64: " Will Deacon
2014-09-24 17:17 ` [PATCH v3 08/17] m32r: " Will Deacon
2014-09-24 17:17 ` [PATCH v3 09/17] m68k: " Will Deacon
2014-09-25  1:05   ` Greg Ungerer
2014-09-25  1:05     ` Greg Ungerer
2014-09-25  9:33     ` Will Deacon
2014-09-25  9:33       ` Will Deacon
2014-09-25  9:51       ` Geert Uytterhoeven
2014-09-25  9:51         ` Geert Uytterhoeven
2014-09-25 10:33         ` Will Deacon
2014-09-25 10:33           ` Will Deacon
2014-09-24 17:17 ` [PATCH v3 10/17] mn10300: " Will Deacon
2014-09-24 17:17 ` [PATCH v3 11/17] parisc: " Will Deacon
2014-09-25 20:00   ` Helge Deller
2014-09-24 17:17 ` [PATCH v3 12/17] powerpc: " Will Deacon
2014-09-24 17:17 ` [PATCH v3 13/17] sparc: " Will Deacon
2014-09-24 17:17 ` [PATCH v3 14/17] tile: " Will Deacon
2014-09-24 17:17 ` [PATCH v3 15/17] x86: " Will Deacon
2014-09-24 17:17 ` [PATCH v3 16/17] documentation: memory-barriers: clarify relaxed io accessor semantics Will Deacon
2014-09-24 17:17 ` [PATCH v3 17/17] asm-generic: io: define relaxed accessor macros unconditionally Will Deacon
2014-09-25 10:42 ` [PATCH v3 00/17] Cross-architecture definitions of relaxed MMIO accessors Arnd Bergmann
2014-09-25 13:15 ` Arnd Bergmann
2014-09-25 14:55   ` Will Deacon
2014-09-25 14:55     ` Will Deacon
2014-09-25 15:07     ` Arnd Bergmann
2014-09-25 15:07       ` Arnd Bergmann
2014-09-25 15:15       ` Arnd Bergmann
2014-09-25 15:15         ` Arnd Bergmann
2014-09-25 15:24         ` Daniel Thompson
2014-09-25 15:24           ` Daniel Thompson
2014-09-25 19:17           ` Arnd Bergmann
2014-09-25 19:17             ` Arnd Bergmann
2014-09-25 20:17             ` Geert Uytterhoeven
2014-09-25 20:17               ` Geert Uytterhoeven
2014-09-26  8:40             ` Russell King - ARM Linux
2014-09-26  8:40               ` Russell King - ARM Linux
2014-09-26  9:28               ` Arnd Bergmann
2014-09-26  9:28                 ` Arnd Bergmann
2014-09-26  8:05         ` Thierry Reding
2014-09-26  8:05           ` Thierry Reding
2014-09-26 13:39           ` Arnd Bergmann
2014-09-26 13:39             ` Arnd Bergmann
2014-09-26 13:46             ` Russell King - ARM Linux
2014-09-26 13:46               ` Russell King - ARM Linux
2014-09-26 21:36               ` Arnd Bergmann
2014-09-26 21:36                 ` Arnd Bergmann
2014-09-29  8:23                 ` Thierry Reding
2014-09-29  8:23                   ` Thierry Reding
2014-09-29  9:50                   ` Arnd Bergmann
2014-09-29  9:50                     ` Arnd Bergmann
2014-10-01 15:23                     ` Thierry Reding
2014-10-01 15:23                       ` Thierry Reding
2014-10-01 18:34                       ` Arnd Bergmann
2014-10-01 18:34                         ` Arnd Bergmann
2014-09-29  9:25                 ` Will Deacon
2014-09-29  9:25                   ` Will Deacon
2014-09-29  9:48                   ` Arnd Bergmann
2014-09-29  9:48                     ` Arnd Bergmann
2014-10-30 16:59   ` Will Deacon
2014-10-30 16:59     ` Will Deacon
2014-10-30 20:04     ` Arnd Bergmann
2014-10-30 20:04       ` Arnd Bergmann
2014-10-31 11:09       ` Thierry Reding
2014-10-31 11:09         ` Thierry Reding

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.