From: "Jan Beulich" Subject: Re: [V6 2/4] x86/xsaves: enable xsaves/xrstors/xsavec in xen Date: Thu, 15 Oct 2015 00:48:31 -0600 Message-ID: <561F685F02000078000AB2F7@prv-mh.provo.novell.com> 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> <20151015015832.GA11071@shuai.ruan@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20151015015832.GA11071@shuai.ruan@linux.intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Shuai Ruan Cc: kevin.tian@intel.com, wei.liu2@citrix.com, eddie.dong@intel.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, jun.nakajima@intel.com, keir@xen.org, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 15.10.15 at 03:58, wrote: > 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 ? Yes, or just keep the current names. (As a side note - one of the two clearly wants its second argument constified.) Jan