Skip to content

Commit 69f77bd

Browse files
terminusKernel Patches Daemon
authored andcommitted
asm-generic: barrier: Add smp_cond_load_acquire_timewait()
Add the acquire variant of smp_cond_load_relaxed_timewait(). 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] Signed-off-by: Ankur Arora <[email protected]>
1 parent 4f671ce commit 69f77bd

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
@@ -308,6 +308,28 @@ do { \
308308
})
309309
#endif
310310

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

0 commit comments

Comments
 (0)