[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UNIKRAFT PATCH 1/2] arch/x86: Provide ukarch_spinwait pause instruction



Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>

On 7/23/20 11:15 AM, Alexander Jung wrote:
> 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__ */
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.