Skip to content

Commit

Permalink
MIPS: barrier: Make __smp_mb__before_atomic() a no-op for Loongson3
Browse files Browse the repository at this point in the history
Loongson3 systems with CONFIG_CPU_LOONGSON3_WORKAROUNDS enabled already
emit a full completion barrier as part of the inline assembly containing
LL/SC loops for atomic operations. As such the barrier emitted by
__smp_mb__before_atomic() is redundant, and we can remove it.

Signed-off-by: Paul Burton <[email protected]>
Cc: [email protected]
Cc: Huacai Chen <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: [email protected]
  • Loading branch information
paulburton committed Oct 7, 2019
1 parent 7f56b12 commit ae4cd0b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion arch/mips/include/asm/barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,17 @@ static inline void wmb(void)
#define nudge_writes() mb()
#endif

#define __smp_mb__before_atomic() __smp_mb__before_llsc()
/*
* In the Loongson3 LL/SC workaround case, all of our LL/SC loops already have
* a completion barrier immediately preceding the LL instruction. Therefore we
* can skip emitting a barrier from __smp_mb__before_atomic().
*/
#ifdef CONFIG_CPU_LOONGSON3_WORKAROUNDS
# define __smp_mb__before_atomic()
#else
# define __smp_mb__before_atomic() __smp_mb__before_llsc()
#endif

#define __smp_mb__after_atomic() smp_llsc_mb()

static inline void sync_ginv(void)
Expand Down

0 comments on commit ae4cd0b

Please sign in to comment.