[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [V7 1/4] x86/xsaves: add basic definitions/helpers to support xsaves
On 20/10/15 09:21, Shuai Ruan wrote: > This patch add basic definitions/helpers which will be used in > later patches. > > Signed-off-by: Shuai Ruan <shuai.ruan@xxxxxxxxxxxxxxx> > Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > --- > xen/arch/x86/xstate.c | 19 +++++++++++++++++++ > xen/include/asm-x86/hvm/vcpu.h | 1 + > xen/include/asm-x86/msr-index.h | 2 ++ > xen/include/asm-x86/xstate.h | 12 ++++++++++-- > 4 files changed, 32 insertions(+), 2 deletions(-) > > diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c > index 9ddff90..4230066 100644 > --- a/xen/arch/x86/xstate.c > +++ b/xen/arch/x86/xstate.c > @@ -24,6 +24,9 @@ static u32 __read_mostly xsave_cntxt_size; > /* A 64-bit bitmask of the XSAVE/XRSTOR features supported by processor. */ > u64 __read_mostly xfeature_mask; > > +/* 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 +63,22 @@ uint64_t get_xcr0(void) > return this_cpu(xcr0); > } > > +void set_msr_xss(u64 xss) > +{ > + u64 *this_xss = &this_cpu(xss); > + > + if ( *this_xss != xss ) > + { > + wrmsrl(MSR_IA32_XSS, xss); > + this_cpu(xss) = xss; *this_xss = xss; Using this_cpu() multiple times cannot be optimised by compiler (because of the underlying definition), which is why the optimisation is performed manually by pulling the value out as a pointer. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |