mcs_spinlock.h 531 B

123456789101112131415161718192021222324
  1. #ifndef __ASM_MCS_LOCK_H
  2. #define __ASM_MCS_LOCK_H
  3. #ifdef CONFIG_SMP
  4. #include <asm/spinlock.h>
  5. /* MCS spin-locking. */
  6. #define arch_mcs_spin_lock_contended(lock) \
  7. do { \
  8. /* Ensure prior stores are observed before we enter wfe. */ \
  9. smp_mb(); \
  10. while (!(smp_load_acquire(lock))) \
  11. wfe(); \
  12. } while (0) \
  13. #define arch_mcs_spin_unlock_contended(lock) \
  14. do { \
  15. smp_store_release(lock, 1); \
  16. dsb_sev(); \
  17. } while (0)
  18. #endif /* CONFIG_SMP */
  19. #endif /* __ASM_MCS_LOCK_H */