From: "Jan Beulich" Subject: Re: [PATCH 0 of 8] FPU LWP: patch description Date: Mon, 09 May 2011 09:39:41 +0100 Message-ID: <4DC7C46D0200007800040552@vpn.id2.novell.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Wei Huang2 , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org >>> On 07.05.11 at 07:39, "Huang2, Wei" wrote: > This patch set supports AMD lightweight profiling for SVM guests. = Because LWP=20 > isn't tracked by CR0.TS bit, we clean up the FPU code to handle lazy = and=20 > unlazy FPU states differently. Lazy FPU state (such as SSE, YMM) is = handled=20 > when #NM is triggered. Unlazy state, such as LWP, is saved and restored = on=20 > each vcpu context switch. >=20 > Per Keir's comments, I moved extended state related code into xstate.c = and=20 > xstate.h. The FPU related code in i387.c was also cleaned up and has=20 > consistent names now. The comments from Jan Beulich were also taken. I = added=20 > a new variable, nonlazy_xstate_used, to control whether save/restore = nonlazy=20 > state. >=20 > =3D=3D=3D=3D=3D=3D i387.c =3D=3D=3D=3D=3D=3D > * void vcpu_restore_fpu_eager(struct vcpu *v); > * void vcpu_restore_fpu_lazy(struct vcpu *v); > * void vcpu_save_fpu(struct vcpu *v); > * int vcpu_init_fpu(struct vcpu *v); > * void vcpu_destroy_fpu(struct vcpu *v); >=20 > =3D=3D=3D=3D=3D=3D xstate.c =3D=3D=3D=3D=3D=3D > * void set_xcr0(u64 xfeatures); > * uint64_t get_xcr0(void); > * void xsave(struct vcpu *v, uint64_t mask); > * void xrstor(struct vcpu *v, uint64_t mask); > * bool_t xsave_enabled(const struct vcpu *v); > * void xstate_free_save_area(struct vcpu *v); > * int xstate_alloc_save_area(struct vcpu *v); > * void xstate_init(void); >=20 >=20 > This code has been tested on real hardware. Please comment. Thanks, Wei - this looks good now to me. Jan >=20 > -Wei >=20 >=20 > b/xen/arch/x86/xstate.c | 188 +++++++++++++++ > b/xen/include/asm-x86/xstate.h | 72 +++++ > tools/libxc/xc_cpuid_x86.c | 6 > xen/arch/x86/Makefile | 1 > xen/arch/x86/acpi/suspend.c | 2 > xen/arch/x86/cpu/common.c | 4 > xen/arch/x86/domain.c | 29 -- > xen/arch/x86/domctl.c | 2 > xen/arch/x86/hvm/hvm.c | 3 > xen/arch/x86/hvm/svm/svm.c | 75 ++++++ > xen/arch/x86/hvm/svm/vmcb.c | 5 > xen/arch/x86/hvm/vmx/vmcs.c | 1 > xen/arch/x86/hvm/vmx/vmx.c | 2 > xen/arch/x86/i387.c | 450 ++++++++++++++++--------------= ------- > xen/arch/x86/traps.c | 3 > xen/include/asm-x86/cpufeature.h | 2 > xen/include/asm-x86/domain.h | 5 > xen/include/asm-x86/hvm/svm/vmcb.h | 3 > xen/include/asm-x86/i387.h | 71 ----- > xen/include/asm-x86/msr-index.h | 4 > 20 files changed, 573 insertions(+), 355 deletions(-) >=20 >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com=20 > http://lists.xensource.com/xen-devel=20