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

Re: [Xen-devel] [V6 1/4] x86/xsaves: add basic definitions/helpers to support xsaves



On 12/10/15 07:07, Shuai Ruan wrote:
> This patch add basic definitions/helpers which will be used in
> later patches.
>
> Signed-off-by: Shuai Ruan <shuai.ruan@xxxxxxxxxxxxxxx>
> ---
>  xen/arch/x86/xstate.c           | 16 ++++++++++++++++
>  xen/include/asm-x86/hvm/vcpu.h  |  1 +
>  xen/include/asm-x86/msr-index.h |  2 ++
>  xen/include/asm-x86/xstate.h    | 25 ++++++++++++++++++++++++-
>  4 files changed, 43 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
> index 9ddff90..730368a 100644
> --- a/xen/arch/x86/xstate.c
> +++ b/xen/arch/x86/xstate.c
> @@ -23,6 +23,11 @@ static u32 __read_mostly xsave_cntxt_size;
>  
>  /* A 64-bit bitmask of the XSAVE/XRSTOR features supported by processor. */
>  u64 __read_mostly xfeature_mask;
> +unsigned int * __read_mostly xstate_offsets;
> +unsigned int * __read_mostly xstate_sizes;
> +
> +/* Cached xss for fast read */
> +static DEFINE_PER_CPU(uint64_t, xss);
>  
>  /* Cached xcr0 for fast read */
>  static DEFINE_PER_CPU(uint64_t, xcr0);
> @@ -60,6 +65,17 @@ uint64_t get_xcr0(void)
>      return this_cpu(xcr0);
>  }
>  
> +void set_msr_xss(u64 xss)
> +{
> +    wrmsrl(MSR_IA32_XSS, xss);
> +    this_cpu(xss) = xss;

This can become faster by doing a lazy write.

u64 * this_xss = &this_cpu(xss);

if ( *this_xss != xss )
{
    wrmsrl(MSR_IA32_XSS, xss);
    *this_xss = xss;
}

Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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