Skip to content

Commit 7e46cbf

Browse files
terminusKernel Patches Daemon
authored andcommitted
asm-generic: barrier: Add smp_cond_load_acquire_timeout()
Add the acquire variant of smp_cond_load_relaxed_timeout(). This reuses the relaxed variant, with an additional LOAD->LOAD ordering. Cc: Arnd Bergmann <[email protected]> Cc: Will Deacon <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Haris Okanovic <[email protected]> Tested-by: Haris Okanovic <[email protected]> Signed-off-by: Ankur Arora <[email protected]>
1 parent bc2b193 commit 7e46cbf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

include/asm-generic/barrier.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,28 @@ do { \
314314
})
315315
#endif
316316

317+
/**
318+
* smp_cond_load_acquire_timeout() - (Spin) wait for cond with ACQUIRE ordering
319+
* until a timeout expires.
320+
*
321+
* Arguments: same as smp_cond_load_relaxed_timeout().
322+
*
323+
* Equivalent to using smp_cond_load_acquire() on the condition variable with
324+
* a timeout.
325+
*/
326+
#ifndef smp_cond_load_acquire_timeout
327+
#define smp_cond_load_acquire_timeout(ptr, cond_expr, time_check_expr) \
328+
({ \
329+
__unqual_scalar_typeof(*ptr) _val; \
330+
_val = smp_cond_load_relaxed_timeout(ptr, cond_expr, \
331+
time_check_expr); \
332+
\
333+
/* Depends on the control dependency of the wait above. */ \
334+
smp_acquire__after_ctrl_dep(); \
335+
(typeof(*ptr))_val; \
336+
})
337+
#endif
338+
317339
/*
318340
* pmem_wmb() ensures that all stores for which the modification
319341
* are written to persistent storage by preceding instructions have

0 commit comments

Comments
 (0)