diff --git a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h index eef052f8d99..c162b945148 100644 --- a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h @@ -7,6 +7,10 @@ #ifndef _ODP_PLAT_TICKETLOCK_INLINES_H_ #define _ODP_PLAT_TICKETLOCK_INLINES_H_ +#if defined(__aarch64__) +#include +#endif + #include #include @@ -47,8 +51,15 @@ _ODP_INLINE void odp_ticketlock_lock(odp_ticketlock_t *ticketlock) /* Spin waiting for our turn. Use load-acquire so that we acquire * all stores from the previous lock owner */ - while (ticket != odp_atomic_load_acq_u32(&ticketlock->cur_ticket)) - odp_cpu_pause(); + #ifdef CONFIG_WFE + sevl(); + while (wfe() && ticket != + monitor32((uint32_t *)&ticketlock->cur_ticket, __ATOMIC_ACQUIRE)) { + } + #else + while (ticket != odp_atomic_load_acq_u32(&ticketlock->cur_ticket)) + odp_cpu_pause(); + #endif } _ODP_INLINE int odp_ticketlock_trylock(odp_ticketlock_t *tklock)