[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH 1/2] arch/x86: Provide ukarch_spinwait pause instruction
This commit introduces the new global `ukarch_spinwait` for x86 which calls the instruction `pause`. It's a more intelligent instruction to call during a spinwait-type operation preventing over utilization of an x86 CPU and so increases performance. More details on the instruction can be found at [0]. [0]: https://c9x.me/x86/html/file_module_x86_id_232.html Signed-off-by: Alexander Jung <alexander.jung@xxxxxxxxx> --- arch/x86/x86_64/include/uk/asm/lcpu.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/x86_64/include/uk/asm/lcpu.h b/arch/x86/x86_64/include/uk/asm/lcpu.h index 6a471a1..f1fd463 100644 --- a/arch/x86/x86_64/include/uk/asm/lcpu.h +++ b/arch/x86/x86_64/include/uk/asm/lcpu.h @@ -118,4 +118,10 @@ static inline unsigned long ukarch_read_sp(void) __asm__ __volatile__("mov %%rsp, %0" : "=r"(sp)); return sp; } + +static inline void ukarch_spinwait(void) +{ + __asm__ __volatile__("pause" : : : "memory"); +} + #endif /* !__ASSEMBLY__ */ -- 2.11.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |