Han, Weidong
2010-Aug-31 02:59 UTC
[Xen-devel] [PATCH 1/4] XSAVE/XRSTOR: Fix frozen states
If a guest sets a state and dirties the state, but later temporarily clears the state, and at this time this vcpu is scheduled out, then other vcpus may corrupt the state before the vcpu is scheduled in again, thus the state cannot be restored correctly. To solve this issue, this patch save/restore all states unconditionally on vcpu context switch. Signed-off-by: Weidong Han <weidong.han@intel.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jan Beulich
2010-Aug-31 06:56 UTC
Re: [Xen-devel] [PATCH 1/4] XSAVE/XRSTOR: Fix frozen states
>>> On 31.08.10 at 04:59, "Han, Weidong" <weidong.han@intel.com> wrote: > If a guest sets a state and dirties the state, but later temporarily clears > the state, and at this time this vcpu is scheduled out, then other vcpus may > corrupt the state before the vcpu is scheduled in again, thus the state > cannot be restored correctly. To solve this issue, this patch save/restore > all states unconditionally on vcpu context switch. > > Signed-off-by: Weidong Han <weidong.han@intel.com>There''s a lot of seemingly unrelated variable renaming in this patch, the essence apparently just being>--- a/xen/arch/x86/i387.c Fri Aug 27 07:10:57 2010 -0400 >+++ b/xen/arch/x86/i387.c Fri Aug 27 12:31:05 2010 -0400 >@@ -35,7 +35,10 @@ void save_init_fpu(struct vcpu *v) > > if ( cpu_has_xsave && is_hvm_vcpu(v) ) > { >+ /* Save all supported feature states */ >+ set_xcr0(xfeature_mask); > xsave(v); >+ set_xcr0(v->arch.hvm_vcpu.xcr0); > } > else if ( cpu_has_fxsr ) > {Now, I wonder what the (performance) price of this is (and will be with larger register sets in the future), and whether the general deferred saving scheme can''t be made work here too. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Aug-31 06:59 UTC
Re: [Xen-devel] [PATCH 1/4] XSAVE/XRSTOR: Fix frozen states
On 31/08/2010 07:56, "Jan Beulich" <JBeulich@novell.com> wrote:>> --- a/xen/arch/x86/i387.c Fri Aug 27 07:10:57 2010 -0400 >> +++ b/xen/arch/x86/i387.c Fri Aug 27 12:31:05 2010 -0400 >> @@ -35,7 +35,10 @@ void save_init_fpu(struct vcpu *v) >> >> if ( cpu_has_xsave && is_hvm_vcpu(v) ) >> { >> + /* Save all supported feature states */ >> + set_xcr0(xfeature_mask); >> xsave(v); >> + set_xcr0(v->arch.hvm_vcpu.xcr0); >> } >> else if ( cpu_has_fxsr ) >> { > > Now, I wonder what the (performance) price of this is (and will be with > larger register sets in the future), and whether the general deferred > saving scheme can''t be made work here too.Well, quite. Seems the cheap easy fix rather than the right fix, doesn''t it. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel