All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>, xen-devel@lists.xenproject.org
Cc: Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH v5 1/3] xsave: fix initialization of FPU memory area
Date: Tue, 1 Dec 2015 13:39:38 +0000	[thread overview]
Message-ID: <565DA31A.2040103@citrix.com> (raw)
In-Reply-To: <1448974025-15915-2-git-send-email-roger.pau@citrix.com>

On 01/12/15 12:47, Roger Pau Monne wrote:
> When the CPU supports XSAVE, the initialization of the FPU memory area is
> done during allocation of the XSAVE area. This is different from the way
> it's done in non-xsave capable CPUs, so unify both paths and always
> initialise the FPU state in vcpu_restore_fpu_lazy.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>  xen/arch/x86/i387.c   | 2 +-
>  xen/arch/x86/xstate.c | 8 --------
>  2 files changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
> index b661d39..fcd87a6 100644
> --- a/xen/arch/x86/i387.c
> +++ b/xen/arch/x86/i387.c
> @@ -226,7 +226,7 @@ void vcpu_restore_fpu_lazy(struct vcpu *v)
>      if ( v->fpu_dirtied )
>          return;
>  
> -    if ( cpu_has_xsave )
> +    if ( cpu_has_xsave && v->fpu_initialised )
>          fpu_xrstor(v, XSTATE_LAZY);
>      else if ( v->fpu_initialised )
>          fpu_fxrstor(v);

I feel this would be clearer if it were rearranged as

if ( v->fpu_initialised )
{
    if ( cpu_has_xsave )
        fpu_xrstor(v, XSTATE_LAZY);
    else
    {
        ...
    }
}
else
    fpu_init();


Functionally however, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

> diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
> index b65da38..8007342 100644
> --- a/xen/arch/x86/xstate.c
> +++ b/xen/arch/x86/xstate.c
> @@ -415,14 +415,6 @@ int xstate_alloc_save_area(struct vcpu *v)
>      if ( save_area == NULL )
>          return -ENOMEM;
>  
> -    /*
> -     * Set the memory image to default values, but don't force the context
> -     * to be loaded from memory (i.e. keep save_area->xsave_hdr.xstate_bv
> -     * clear).
> -     */
> -    save_area->fpu_sse.fcw = FCW_DEFAULT;
> -    save_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
> -
>      v->arch.xsave_area = save_area;
>      v->arch.xcr0 = 0;
>      v->arch.xcr0_accum = 0;


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2015-12-01 13:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 12:47 [PATCH v5 0/3] Introduce a flags field to HVM CPU context Roger Pau Monne
2015-12-01 12:47 ` [PATCH v5 1/3] xsave: fix initialization of FPU memory area Roger Pau Monne
2015-12-01 13:39   ` Andrew Cooper [this message]
2015-12-01 13:58     ` Jan Beulich
2015-12-01 12:47 ` [PATCH v5 2/3] xen/hvm: introduce a flags field in the CPU save record Roger Pau Monne
2015-12-01 13:43   ` Andrew Cooper
2015-12-01 12:47 ` [PATCH v5 3/3] Revert "libxc: create an initial FPU state for HVM guests" Roger Pau Monne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=565DA31A.2040103@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.