blob: 193fb4c2e7129ab2a2ce12e22e3d6976f92b4284 [file] [log] [blame]
#ifndef _ASM_X86_BARRIER_H_
#define _ASM_X86_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