From: Shuai Ruan Subject: Re: XSAVE flavors Date: Thu, 18 Feb 2016 11:19:40 +0800 Message-ID: <4231.71767402$1455765818@news.gmane.org> References: <56A791BA02000078000CB1C9@prv-mh.provo.novell.com> <56A79AE402000078000CB224@prv-mh.provo.novell.com> <20160202063110.GB3036@shuai.ruan@linux.intel.com> <56B0881E02000078000CD58A@prv-mh.provo.novell.com> <20160204064935.GB13660@shuai.ruan@linux.intel.com> <56B31F2602000078000CE77A@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: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWFAT-0002tD-7H for xen-devel@lists.xenproject.org; Thu, 18 Feb 2016 03:22:13 +0000 Content-Disposition: inline In-Reply-To: <56B31F2602000078000CE77A@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: xen-devel , Kevin Tian , Jun Nakajima List-Id: xen-devel@lists.xenproject.org On Thu, Feb 04, 2016 at 01:51:34AM -0700, Jan Beulich wrote: > >> >> And I'm afraid there's yet one more issue: If my reading of the > >> >> SDM is right, then the offsets at which components get saved > >> >> by XSAVEC / XSAVES aren't fixed, but depend on RFBM (as that's > >> >> what gets stored into xcomp_bv[62:0]). xstate_comp_offsets[], > >> >> otoh, gets computed based on all available features, irrespective > >> >> of vcpu_xsave_mask() returning four different values depending > >> >> on current guest state. I can't see how get_xsave_addr() can > >> >> work correctly without honoring xcomp_bv. Nor can I convince > >> >> myself that state can't get corrupted / lost, e.g. when a save > >> >> with v->fpu_dirtied set is followed by one with v->fpu_dirtied > >> >> clear. > >> >> > >> >> Am I misunderstanding what the SDM writes? > >> >> > >> > Yes. you are right. This is a issue. I will find a way to solve > >> > this. > >> > >> Thanks. > > > > For xstate_comp_offsets is only used in get_xsave_addr when performing > > migration. > > I intend to recaculte xstate_comp_offsets based on the > > vcpu->arch.xsavec_area.save_hdr.xcomp_bv > > before get_xsave_addr is called. > > I don't think that'll suffice, as it won't deal with the lazy XSAVE[SC] > possibly overwriting data written by the non-lazy one. See the > effectively three different values returned by vcpu_xsave_mask() > (the fourth one is impossible since the function won't ever get > called with both v->fpu_dirtied and v->arch.nonlazy_xstate_used > clear). Oh, Yes, Thanks. The way I think to solve the problem is: if v->fpu_dirtied is clear and v->arch.nonlazy_xstate_used is set, vcpu_xsave_mask will return XSTATE_ALL (only if xsave[sc] is support). But this will do some overhead save. > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel >