Skip to content

Commit a254c70

Browse files
terminusKernel Patches Daemon
authored andcommitted
arm64: barrier: Support smp_cond_load_relaxed_timeout()
Support waiting in smp_cond_load_relaxed_timeout() via __cmpwait_relaxed(). Limit this to when the event-stream is enabled, to ensure that we wake from WFE periodically and don't block forever if there are no stores to the cacheline. In the unlikely event that the event-stream is unavailable, fallback to spin-waiting. Also set SMP_TIMEOUT_POLL_COUNT to 1 so we do the time-check for each iteration in smp_cond_load_relaxed_timeout(). Cc: [email protected] Cc: Catalin Marinas <[email protected]> Suggested-by: Will Deacon <[email protected]> Signed-off-by: Ankur Arora <[email protected]>
1 parent 9ef8a4e commit a254c70

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

arch/arm64/include/asm/barrier.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,19 @@ do { \
219219
(typeof(*ptr))VAL; \
220220
})
221221

222+
#define SMP_TIMEOUT_POLL_COUNT 1
223+
224+
/* Re-declared here to avoid include dependency. */
225+
extern bool arch_timer_evtstrm_available(void);
226+
227+
#define cpu_poll_relax(ptr, val) \
228+
do { \
229+
if (arch_timer_evtstrm_available()) \
230+
__cmpwait_relaxed(ptr, val); \
231+
else \
232+
cpu_relax(); \
233+
} while (0)
234+
222235
#include <asm-generic/barrier.h>
223236

224237
#endif /* __ASSEMBLY__ */

0 commit comments

Comments
 (0)