Commit d77d128f authored by Peter Xu's avatar Peter Xu Committed by Paolo Bonzini
Browse files

x86/asm: add cpu_relax()

This will be useful to be put inside loops.

Suggested-by: Andrew Jones's avatarAndrew Jones <>
Reviewed-by: Andrew Jones's avatarAndrew Jones <>
Signed-off-by: default avatarPeter Xu <>
Signed-off-by: default avatarPaolo Bonzini <>
parent 7d4c532d
......@@ -13,4 +13,15 @@
#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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment