Skip to content

Commit 49a7d46

Browse files
npigginmpe
authored andcommitted
powerpc: Implement smp_cond_load_relaxed()
This implements smp_cond_load_relaxed() with the slowpath busy loop using the preferred SMT priority pattern. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Acked-by: Waiman Long <longman@redhat.com> [mpe: Make it 64-bit only to fix build errors on 32-bit] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200724131423.1362108-7-npiggin@gmail.com
1 parent 2f6560e commit 49a7d46

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎arch/powerpc/include/asm/barrier.h‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,22 @@ do { \
8080
___p1; \
8181
})
8282

83+
#ifdef CONFIG_PPC64
84+
#define smp_cond_load_relaxed(ptr, cond_expr) ({ \
85+
typeof(ptr) __PTR = (ptr); \
86+
__unqual_scalar_typeof(*ptr) VAL; \
87+
VAL = READ_ONCE(*__PTR); \
88+
if (unlikely(!(cond_expr))) { \
89+
spin_begin(); \
90+
do { \
91+
VAL = READ_ONCE(*__PTR); \
92+
} while (!(cond_expr)); \
93+
spin_end(); \
94+
} \
95+
(typeof(*ptr))VAL; \
96+
})
97+
#endif
98+
8399
#ifdef CONFIG_PPC_BOOK3S_64
84100
#define NOSPEC_BARRIER_SLOT nop
85101
#elif defined(CONFIG_PPC_FSL_BOOK3E)

0 commit comments

Comments
 (0)