]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
emulate illumos membar_producer with atomic_thread_fence_rel
authoravg <avg@FreeBSD.org>
Thu, 10 Oct 2019 07:39:41 +0000 (07:39 +0000)
committeravg <avg@FreeBSD.org>
Thu, 10 Oct 2019 07:39:41 +0000 (07:39 +0000)
commit50cdda62fced8d21e45858e01dc375a10f1749ea
tree747925dc4e9addac8874e8b361211d9115b76232
parent235ed49b64e7294cfe26e8c619c13717d7e44683
emulate illumos membar_producer with atomic_thread_fence_rel

membar_producer is supposed to be a store-store barrier.
Also, in the code that FreeBSD has ported from illumos membar_producer
is used only with regular stores to regular memory (with respect to
caching).

We do not have an MI primitive for the store-store barrier, so
atomic_thread_fence_rel is the closest we have as it provides
(load | store) -> store barrier.

Previously, membar_producer was an empty function call on all 32-bit
arm-s, 32-bit powerpc, riscv and all mips variants.  I think that it was
inadequate.
On other platforms, such as amd64, arm64, i386, powerpc64, sparc64,
membar_producer was implemented using stronger primitives than required
for a store-store barrier with respect to regular memory access.
For example, it used sfence on amd64 and lock-ed nop in i386 (despite TSO).
On powerpc64 we now use recommended lwsync instead of eieio.
On sparc64 FreeBSD uses TSO mode.
On arm64/aarch64 we now use dmb sy instead of dmb ish.  Not sure if this
is an improvement, actually.

After this change we can drop opensolaris_atomic.S for aarch64, amd64,
powerpc64 and sparc64 as all required atomic operations have either
direct or light-weight mapping to FreeBSD native atomic operations.

Discussed with: kib
MFC after: 4 weeks
15 files changed:
share/man/man4/superio.4 [new file with mode: 0644]
share/man/man9/superio.9 [new file with mode: 0644]
sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
sys/cddl/compat/opensolaris/sys/atomic.h
sys/cddl/contrib/opensolaris/common/atomic/aarch64/opensolaris_atomic.S [deleted file]
sys/cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S [deleted file]
sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S
sys/cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S [deleted file]
sys/cddl/contrib/opensolaris/common/atomic/sparc64/opensolaris_atomic.S [deleted file]
sys/conf/files.amd64
sys/conf/files.arm
sys/conf/files.arm64
sys/conf/files.powerpc
sys/conf/files.riscv
sys/conf/files.sparc64