kernel_optimize_test/include/asm-i386
Nick Piggin 4827bbb06e i386: remove bogus comment about memory barrier
The comment being removed by this patch is incorrect and misleading.

In the following situation:

	1. load  ...
	2. store 1 -> X
	3. wmb
	4. rmb
	5. load  a <- Y
	6. store ...

4 will only ensure ordering of 1 with 5.
3 will only ensure ordering of 2 with 6.

Further, a CPU with strictly in-order stores will still only provide that
2 and 6 are ordered (effectively, it is the same as a weakly ordered CPU
with wmb after every store).

In all cases, 5 may still be executed before 2 is visible to other CPUs!

The additional piece of the puzzle that mb() provides is the store/load
ordering, which fundamentally cannot be achieved with any combination of
rmb()s and wmb()s.

This can be an unexpected result if one expected any sort of global ordering
guarantee to barriers (eg. that the barriers themselves are sequentially
consistent with other types of barriers).  However sfence or lfence barriers
need only provide an ordering partial ordering of memory operations -- Consider
that wmb may be implemented as nothing more than inserting a special barrier
entry in the store queue, or, in the case of x86, it can be a noop as the store
queue is in order. And an rmb may be implemented as a directive to prevent
subsequent loads only so long as their are no previous outstanding loads (while
there could be stores still in store queues).

I can actually see the occasional load/store being reordered around lfence on
my core2. That doesn't prove my above assertions, but it does show the comment
is wrong (unless my program is -- can send it out by request).

So:
   mb() and smp_mb() always have and always will require a full mfence
   or lock prefixed instruction on x86.  And we should remove this comment.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Paul McKenney <paulmck@us.ibm.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-09-29 09:13:59 -07:00
..
mach-bigsmp
mach-default i386: Fix a couple busy loops in mach_wakecpu.h:wait_for_init_deassert() 2007-08-18 09:54:44 -07:00
mach-es7000 i386: Fix a couple busy loops in mach_wakecpu.h:wait_for_init_deassert() 2007-08-18 09:54:44 -07:00
mach-generic
mach-numaq
mach-summit
mach-visws
mach-voyager i386: remove pit_interrupt_hook 2007-07-21 18:37:08 -07:00
xen
8253pit.h
a.out.h
acpi.h ACPI: Kconfig: remove CONFIG_ACPI_SLEEP from source 2007-07-25 01:29:39 -04:00
agp.h
alternative-asm.i
alternative.h x86: Fix alternatives and kprobes to remap write-protected kernel text 2007-07-22 11:03:37 -07:00
apic.h i386: Use global flag to disable broken local apic timer on AMD CPUs. 2007-08-11 15:58:13 -07:00
apicdef.h
arch_hooks.h
atomic.h
auxvec.h
bitops.h
boot.h
bootparam.h [x86 setup] Make struct ist_info cross-architecture, and use in setup code 2007-07-25 12:02:21 -07:00
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
checksum.h
cmpxchg.h i386: Use patchable lock prefix in set_64bit 2007-07-22 11:03:38 -07:00
cpu.h
cpufeature.h i386: Use global flag to disable broken local apic timer on AMD CPUs. 2007-08-11 15:58:13 -07:00
cputime.h
current.h
debugreg.h
delay.h
desc.h
device.h
div64.h
dma-mapping.h
dma.h
dmi.h
dwarf2.h
e820.h Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION 2007-07-29 16:45:38 -07:00
edac.h
elf.h
emergency-restart.h
errno.h
fb.h
fcntl.h
fixmap.h
floppy.h
frame.i
futex.h
genapic.h
geode.h i386: basic infrastructure support for AMD geode-class machines 2007-07-21 18:37:14 -07:00
hardirq.h
highmem.h
hpet.h x86: share hpet.h with i386 2007-07-21 18:37:09 -07:00
hw_irq.h
hypertransport.h
i387.h
i8253.h i386: move PIT function declarations and constants to correct header file 2007-07-21 18:37:14 -07:00
i8259.h
ide.h
intel_arch_perfmon.h
io_apic.h ACPI: boot correctly with "nosmp" or "maxcpus=0" 2007-08-21 00:33:35 -04:00
io.h PCI: Document pci_iomap() 2007-08-22 14:48:40 -07:00
ioctl.h
ioctls.h
ipc.h
ipcbuf.h
irq_regs.h
irq.h
irqflags.h
ist.h [x86 setup] Make struct ist_info cross-architecture, and use in setup code 2007-07-25 12:02:21 -07:00
k8.h
Kbuild
kdebug.h
kexec.h
kmap_types.h
kprobes.h
ldt.h
linkage.h
local.h
math_emu.h
mc146818rtc.h i386: add cpu_relax() to cmos_lock() 2007-07-21 18:37:13 -07:00
mca_dma.h
mca.h
mce.h x86: Stop MCEs and NMIs during code patching 2007-07-22 11:03:37 -07:00
mman.h
mmu_context.h
mmu.h
mmx.h
mmzone.h
module.h
mpspec_def.h
mpspec.h
msgbuf.h
msidef.h
msr-index.h
msr.h
mtrr.h
mutex.h
namei.h
nmi.h x86_64: Fix to keep watchdog disabled by default for i386/x86_64 2007-08-18 10:25:25 -07:00
numa.h
numaq.h
page.h i386: minor nx handling adjustment 2007-07-21 18:37:09 -07:00
param.h
paravirt.h i386: Make patching more robust, fix paravirt issue 2007-08-11 15:58:13 -07:00
parport.h
pci-direct.h
pci.h finish i386 and x86-64 sysdata conversion 2007-08-11 15:47:42 -07:00
percpu.h
pgalloc.h
pgtable-2level-defs.h
pgtable-2level.h
pgtable-3level-defs.h
pgtable-3level.h
pgtable.h
poll.h
posix_types.h
processor-cyrix.h x86: Replace NSC/Cyrix specific chipset access macros by inlined functions. 2007-07-22 11:03:38 -07:00
processor-flags.h
processor.h x86: Replace NSC/Cyrix specific chipset access macros by inlined functions. 2007-07-22 11:03:38 -07:00
ptrace-abi.h
ptrace.h
reboot_fixups.h
reboot.h
required-features.h
resource.h
resume-trace.h x86: PM_TRACE support 2007-07-21 18:37:10 -07:00
rtc.h
rwlock.h
rwsem.h
scatterlist.h
seccomp.h
sections.h
segment.h
semaphore.h
sembuf.h
serial.h revert "x86, serial: convert legacy COM ports to platform devices" 2007-07-31 15:39:38 -07:00
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
smp.h
socket.h
sockios.h
sparsemem.h
spinlock_types.h
spinlock.h
srat.h
stacktrace.h
stat.h
statfs.h
string.h i386: Move all simple string operations out of line 2007-07-21 18:37:08 -07:00
suspend.h ACPI: Kconfig: remove CONFIG_ACPI_SLEEP from source 2007-07-25 01:29:39 -04:00
sync_bitops.h
system.h i386: remove bogus comment about memory barrier 2007-09-29 09:13:59 -07:00
termbits.h
termios.h
therm_throt.h
thread_info.h remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
time.h
timer.h i386: move PIT function declarations and constants to correct header file 2007-07-21 18:37:14 -07:00
timex.h
tlb.h
tlbflush.h i386: add reference to the arguments 2007-07-21 18:37:10 -07:00
topology.h x86-64: introduce struct pci_sysdata to facilitate sharing of ->sysdata 2007-07-21 18:37:14 -07:00
tsc.h
types.h
uaccess.h i386: replace hard-coded constant with appropriate macro from kernel.h 2007-07-21 18:37:13 -07:00
ucontext.h
unaligned.h
unistd.h
unwind.h
user.h
vga.h
vic.h
vm86.h
vmi_time.h
vmi.h
voyager.h
xor.h