| #ifndef _ASMX86_BARRIER_H_ |
| #define _ASMX86_BARRIER_H_ |
| /* |
| * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@redhat.com> |
| * |
| * This work is licensed under the terms of the GNU LGPL, version 2. |
| */ |
| |
| #define mb() asm volatile("mfence":::"memory") |
| #define rmb() asm volatile("lfence":::"memory") |
| #define wmb() asm volatile("sfence":::"memory") |
| |
| #define smp_rmb() barrier() |
| #define smp_wmb() barrier() |
| |
| /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ |
| static inline void rep_nop(void) |
| { |
| asm volatile("rep; nop" ::: "memory"); |
| } |
| |
| static inline void cpu_relax(void) |
| { |
| rep_nop(); |
| } |
| |
| #endif |