linux-stable/Documentation
Peter Zijlstra 69d927bba3 x86/atomic: Fix smp_mb__{before,after}_atomic()
Recent probing at the Linux Kernel Memory Model uncovered a
'surprise'. Strongly ordered architectures where the atomic RmW
primitive implies full memory ordering and
smp_mb__{before,after}_atomic() are a simple barrier() (such as x86)
fail for:

	*x = 1;
	atomic_inc(u);
	smp_mb__after_atomic();
	r0 = *y;

Because, while the atomic_inc() implies memory order, it
(surprisingly) does not provide a compiler barrier. This then allows
the compiler to re-order like so:

	atomic_inc(u);
	*x = 1;
	smp_mb__after_atomic();
	r0 = *y;

Which the CPU is then allowed to re-order (under TSO rules) like:

	atomic_inc(u);
	r0 = *y;
	*x = 1;

And this very much was not intended. Therefore strengthen the atomic
RmW ops to include a compiler barrier.

NOTE: atomic_{or,and,xor} and the bitops already had the compiler
barrier.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2019-06-17 12:09:59 +02:00
..
ABI Documentation: net-sysfs: Remove duplicate PHY device documentation 2019-05-28 17:26:44 -07:00
accelerators
accounting
acpi/dsd
admin-guide mm, memcg: consider subtrees in memory.events 2019-06-01 15:51:31 -07:00
aoe
arm
arm64 arm64/sve: Fix missing SVE/FPSIMD endianness conversions 2019-06-13 10:07:19 +01:00
auxdisplay
backlight
block block/switching-sched.txt: Update to blk-mq schedulers 2019-06-13 03:00:30 -06:00
blockdev
bpf
bus-devices
cdrom
cgroup-v1 Merge branch 'for-5.2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup 2019-06-14 17:46:14 -10:00
cma
connector
console
core-api
cpu-freq
crypto
dev-tools
device-mapper
devicetree dt: bindings: mtd: replace references to nand.txt with nand-controller.yaml 2019-05-22 09:08:20 -05:00
doc-guide
driver-api counter: fix Documentation build error due to incorrect source file name 2019-05-20 13:18:45 -06:00
driver-model i2c: core: add device-managed version of i2c_new_dummy 2019-05-17 19:29:40 +02:00
early-userspace
EDID
extcon
fault-injection
fb
features
filesystems ovl: doc: add non-standard corner cases 2019-05-31 11:27:25 +02:00
firmware-guide docs: fix multiple doc build warnings in enumeration.rst 2019-05-23 09:27:39 -06:00
firmware_class
fmc
fpga
gpio
gpu
hid
hwmon
i2c
ia64
ide
iio
infiniband
input
interconnect
ioctl
isdn
kbuild kbuild: drop support for cc-ldoption 2019-05-21 00:02:59 +09:00
kdump Documentation: kdump: fix minor typo 2019-05-21 09:31:28 -06:00
kernel-hacking
laptops
leds
lightnvm
livepatch
locking locking/lockdep: Add explanation to lock usage rules in lockdep design doc 2019-06-03 11:55:48 +02:00
m68k
maintainer
md
media media updates for v5.2-rc1 2019-05-16 11:57:16 -07:00
memory-devices
mic
mips
misc-devices
mmc
mtd
namespaces
netlabel
networking Documentation: add TLS offload documentation 2019-05-22 12:18:20 -07:00
nfc
nios2
nvdimm
nvmem
openrisc
parisc
PCI
pcmcia
perf
phy
platform
power
powerpc
pps
process
pti
ptp
rapidio
RCU
riscv
s390
scheduler
scsi
security
serial
sh
sound
sparc
sphinx doc: Cope with the deprecation of AutoReporter 2019-05-23 09:23:11 -06:00
sphinx-static
spi
sysctl
target
thermal
timers
trace
translations
usb USB: rio500: update Documentation 2019-05-21 10:11:19 +02:00
userspace-api
virtual * ARM: support for SVE and Pointer Authentication in guests, PMU improvements 2019-05-17 10:33:30 -07:00
vm mm: fix Documentation/vm/hmm.rst Sphinx warnings 2019-06-01 15:51:31 -07:00
w1
watchdog
wimax
x86
xilinx
xtensa
.gitignore
atomic_bitops.txt
atomic_t.txt x86/atomic: Fix smp_mb__{before,after}_atomic() 2019-06-17 12:09:59 +02:00
bt8xxgpio.txt
btmrvl.txt
bus-virt-phys-mapping.txt
Changes
clearing-warn-once.txt
CodingStyle
conf.py docs: Fix conf.py for Sphinx 2.0 2019-05-24 09:09:32 -06:00
cpu-load.txt
cputopology.txt
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
digsig.txt
DMA-API-HOWTO.txt
DMA-API.txt
DMA-attributes.txt
DMA-ISA-LPC.txt
docutils.conf
dontdiff
efi-stub.txt
eisa.txt
futex-requeue-pi.txt
gcc-plugins.txt
highuid.txt
hw_random.txt
hwspinlock.txt
index.rst
Intel-IOMMU.txt
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
IPMI.txt
IRQ-affinity.txt
IRQ-domain.txt
IRQ.txt
irqflags-tracing.txt
isa.txt
isapnp.txt
kernel-per-CPU-kthreads.txt
kobject.txt
kprobes.txt
kref.txt
ldm.txt
lockup-watchdogs.txt
logo.gif
logo.txt
lsm.txt
lzo.txt
mailbox.txt
Makefile
memory-barriers.txt
men-chameleon-bus.txt
nommu-mmap.txt
ntb.txt
numastat.txt
packing.txt
padata.txt
parport-lowlevel.txt
percpu-rw-semaphore.txt
phy.txt
pi-futex.txt
pnp.txt
preempt-locking.txt
pwm.txt
rbtree.txt
remoteproc.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt
rtc.txt
SAK.txt
sgi-ioc4.txt
siphash.txt
SM501.txt
smsc_ece1099.txt
speculation.txt
static-keys.txt
SubmittingPatches
svga.txt
switchtec.txt
sync_file.txt
tee.txt
this_cpu_ops.txt
unaligned-memory-access.txt
vfio-mediated-device.txt
vfio.txt
video-output.txt
xillybus.txt
xz.txt
zorro.txt