From: "Jan Beulich" Subject: Re: [PATCHv2 1/3] x86/fpu: improve check for XSAVE* not writing FIP/FDP fields Date: Tue, 23 Feb 2016 07:07:57 -0700 Message-ID: <56CC75CD02000078000D53C6@prv-mh.provo.novell.com> References: <1456225539-9162-1-git-send-email-david.vrabel@citrix.com> <1456225539-9162-2-git-send-email-david.vrabel@citrix.com> <56CC3FE8.4000805@citrix.com> <56CC4868.8040504@citrix.com> 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 1aYDdC-0002PT-3m for xen-devel@lists.xenproject.org; Tue, 23 Feb 2016 14:08:02 +0000 In-Reply-To: <56CC4868.8040504@citrix.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: David Vrabel Cc: Andrew Cooper , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 23.02.16 at 12:54, wrote: > On 23/02/16 11:18, Andrew Cooper wrote: >> On 23/02/16 11:05, David Vrabel wrote: >>> The hardware may not write the FIP/FDP fields with a XSAVE* >>> instruction. e.g., with XSAVEOPT/XSAVES if the state hasn't changed >>> or on AMD CPUs when a floating point exception is not pending. We >>> need to identify this case so we can correctly apply the check for >>> whether to save/restore FCS/FDS. >>> >>> By toggling FIP[63] we can turn the field into a non-canonical address >>> and check for this value after the XSAVE instruction. >>> >>> This results in smaller code with fewer branches and is more >>> understandable. >>> >>> Signed-off-by: David Vrabel >> >> For consistently, the same change in detection logic should be applied >> to fpu_fxsave() > > I don't think it is necessary. fpu_fxsave() only needs to check for the > AMD case, and the logic is already simple. I agree. Jan