Re: [Xen-devel] [V5] x86/xsaves: fix overwriting between non-lazy/lazy xsaves

2016-03-23 Thread Shuai Ruan
On Wed, Mar 23, 2016 at 04:21:32AM -0600, Jan Beulich wrote: > >>> On 23.03.16 at 07:14, wrote: > > But for hvm_vcpu_reset_state(), I think we should deleting the code > > initializing the xcomp_bv as said below. > >> For hvm_vcpu_reset_state(), we should depend on

Re: [Xen-devel] [V5] x86/xsaves: fix overwriting between non-lazy/lazy xsaves

2016-03-23 Thread Jan Beulich
>>> On 23.03.16 at 07:14, wrote: > On Wed, Mar 23, 2016 at 10:02:24AM +0800, Shuai Ruan wrote: > But for hvm_vcpu_reset_state(), I think we should deleting the code > initializing the xcomp_bv as said below. >> For hvm_vcpu_reset_state(), we should depend on whether

Re: [Xen-devel] [V5] x86/xsaves: fix overwriting between non-lazy/lazy xsaves

2016-03-23 Thread Shuai Ruan
On Wed, Mar 23, 2016 at 10:02:24AM +0800, Shuai Ruan wrote: > > > -/* Set XSTATE_BV and XCOMP_BV. */ > > > +/* Set XSTATE_BV. */ > > > xsave->xsave_hdr.xstate_bv = xstate_bv; > > > -xsave->xsave_hdr.xcomp_bv = v->arch.xcr0_accum | > > > XSTATE_COMPACTION_ENABLED; > > >

Re: [Xen-devel] [V5] x86/xsaves: fix overwriting between non-lazy/lazy xsaves

2016-03-22 Thread Shuai Ruan
On Tue, Mar 22, 2016 at 08:34:33AM -0600, Jan Beulich wrote: > >>> On 18.03.16 at 04:01, wrote: > > * Copy legacy XSAVE area, to avoid complications with CPUID > > * leaves 0 and 1 in the loop below. > > */ > > memcpy(xsave, src, FXSAVE_SIZE); >

Re: [Xen-devel] [V5] x86/xsaves: fix overwriting between non-lazy/lazy xsaves

2016-03-22 Thread Jan Beulich
>>> On 18.03.16 at 04:01, wrote: > v5: Address comments from Jan > 1. Add XSTATE_XSAVES_ONLY and using xsaves depend on whether this bits are >set in xcr0_accum > 2. Change compress logic in compress_xsave_states() depend on >!(v->arch.xcr0_accum &

[Xen-devel] [V5] x86/xsaves: fix overwriting between non-lazy/lazy xsaves

2016-03-19 Thread Shuai Ruan
The offset at which components xsaved by xsave[sc] are not fixed. So when when a save with v->fpu_dirtied set is followed by one with v->fpu_dirtied clear, non-lazy xsave[sc] may overwriting data written by the lazy one. The solution is when using_xsave_compact is enabled and taking xcr0_accum