From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCHv2 2/3] x86/fpu: Add a per-domain field to set the width of FIP/FDP Date: Tue, 23 Feb 2016 16:27:06 +0000 Message-ID: <56CC885A.7080206@citrix.com> References: <1456225539-9162-1-git-send-email-david.vrabel@citrix.com> <1456225539-9162-3-git-send-email-david.vrabel@citrix.com> <56CC87A202000078000D546A@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYFnr-00020i-4H for xen-devel@lists.xenproject.org; Tue, 23 Feb 2016 16:27:11 +0000 In-Reply-To: <56CC87A202000078000D546A@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 , David Vrabel Cc: Andrew Cooper , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On 23/02/16 15:24, Jan Beulich wrote: >>>> On 23.02.16 at 12:05, wrote: >> @@ -292,17 +296,17 @@ void xsave(struct vcpu *v, uint64_t mask) >> asm volatile ( "fnstenv %0" : "=m" (fpu_env) ); >> ptr->fpu_sse.fip.sel = fpu_env.fcs; >> ptr->fpu_sse.fdp.sel = fpu_env.fds; >> - word_size = 4; >> + fip_width = 4; >> } >> + else >> + fip_width = 8; >> } >> else >> { >> XSAVE(""); >> - word_size = 4; >> } >> #undef XSAVE >> - if ( word_size >= 0 ) >> - ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET] = word_size; >> + ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET] = fip_width; >> } > > There's actually a pre-existing bug here that I think should get > fixed at once: The 64-bit save path avoided to update > ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET] when FPU state > didn't get saved (by setting word_size to -1), which continues to be > the case due to patch 1's changes. The 32-bit code path violated > this even before your change. I.e. the last else visible above > should get extended to return when !(mask & XSTATE_FP). XSTATE_FP is always set in the mask. (see fpu_xsave()). David