1 #ifndef _ASMX86_BARRIER_H_ 2 #define _ASMX86_BARRIER_H_ 3 /* 4 * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@redhat.com> 5 * 6 * This work is licensed under the terms of the GNU LGPL, version 2. 7 */ 8 9 #define mb() asm volatile("mfence":::"memory") 10 #define rmb() asm volatile("lfence":::"memory") 11 #define wmb() asm volatile("sfence":::"memory") 12 13 #define smp_rmb() barrier() 14 #define smp_wmb() barrier() 15 16 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ rep_nop(void)17static inline void rep_nop(void) 18 { 19 asm volatile("rep; nop" ::: "memory"); 20 } 21 cpu_relax(void)22static inline void cpu_relax(void) 23 { 24 rep_nop(); 25 } 26 27 #endif 28