From: Shuai Ruan Subject: Re: [V6 2/4] x86/xsaves: enable xsaves/xrstors/xsavec in xen Date: Thu, 15 Oct 2015 09:58:32 +0800 Message-ID: <9238.79027036509$1444874429@news.gmane.org> References: <1444630048-19411-1-git-send-email-shuai.ruan@linux.intel.com> <1444630048-19411-3-git-send-email-shuai.ruan@linux.intel.com> <561D27F802000078000AA9C9@prv-mh.provo.novell.com> Reply-To: Shuai Ruan Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <561D27F802000078000AA9C9@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: kevin.tian@intel.com, wei.liu2@citrix.com, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, eddie.dong@intel.com, xen-devel@lists.xen.org, jun.nakajima@intel.com, keir@xen.org, ian.jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Tue, Oct 13, 2015 at 07:49:12AM -0600, Jan Beulich wrote: > >>> On 12.10.15 at 08:07, wrote: > > > @@ -2257,9 +2261,14 @@ static int hvm_load_cpu_xsave_states(struct domain *d, hvm_domain_context_t *h) > > v->arch.xcr0_accum = ctxt->xcr0_accum; > > if ( ctxt->xcr0_accum & XSTATE_NONLAZY ) > > v->arch.nonlazy_xstate_used = 1; > > - memcpy(v->arch.xsave_area, &ctxt->save_area, > > - min(desc->length, size) - offsetof(struct hvm_hw_cpu_xsave, > > - save_area)); > > + if ( (cpu_has_xsaves || cpu_has_xsavec) ) > > + compress_xsave_states(v, &ctxt->save_area, > > + min(desc->length, size) - > > + offsetof(struct hvm_hw_cpu_xsave,save_area)); > > + else > > + memcpy(v->arch.xsave_area, &ctxt->save_area, > > + min(desc->length, size) - offsetof(struct hvm_hw_cpu_xsave, > > + save_area)); > > Each time I look at these two hunks I wonder whether the condition > and memcpy() wouldn't better move into the new called functions. > Will func name void load_xsave_area(struct vcpu *v, struct hvm_hw_cpu_xsave *ctxt) void save_xsave_area(struct vcpu *v, struct hvm_hw_cpu_xsave *ctxt) Ok ? > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel >