]> git.baikalelectronics.ru Git - kernel.git/commit
mips/atomic: Fix loongson_llsc_mb() wreckage
authorPeter Zijlstra <peterz@infradead.org>
Thu, 13 Jun 2019 13:43:19 +0000 (15:43 +0200)
committerPaul Burton <paul.burton@mips.com>
Sat, 31 Aug 2019 10:05:17 +0000 (11:05 +0100)
commitab3e0a6c773de868a03e4cf53465110fd75c5f6c
treea3337041a74654c9427dbbaeca1a7a917db996e3
parent4432c2938b02a4db55938549f9fabdfd58338920
mips/atomic: Fix loongson_llsc_mb() wreckage

The comment describing the loongson_llsc_mb() reorder case doesn't
make any sense what so ever. Instruction re-ordering is not an SMP
artifact, but rather a CPU local phenomenon. Clarify the comment by
explaining that these issue cause a coherence fail.

For the branch speculation case; if futex_atomic_cmpxchg_inatomic()
needs one at the bne branch target, then surely the normal
__cmpxch_asm() implementation does too. We cannot rely on the
barriers from cmpxchg() because cmpxchg_local() is implemented with
the same macro, and branch prediction and speculation are, too, CPU
local.

Fixes: d081983e629c ("MIPS: Loongson: Introduce and use loongson_llsc_mb()")
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Huang Pei <huangpei@loongson.cn>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Paul Burton <paul.burton@mips.com>
arch/mips/include/asm/atomic.h
arch/mips/include/asm/barrier.h
arch/mips/include/asm/bitops.h
arch/mips/include/asm/cmpxchg.h
arch/mips/kernel/syscall.c