All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v4 3/4] xen/hvm: introduce a flags field in the CPU save record
Date: Fri, 27 Nov 2015 17:15:02 +0100	[thread overview]
Message-ID: <56588186.4080405@citrix.com> (raw)
In-Reply-To: <565725F402000078000B96A9@prv-mh.provo.novell.com>

El 26/11/15 a les 15.32, Jan Beulich ha escrit:
>>>> On 25.11.15 at 16:18, <roger.pau@citrix.com> wrote:
>> --- a/xen/arch/x86/hvm/hvm.c
>> +++ b/xen/arch/x86/hvm/hvm.c
>> @@ -2085,16 +2091,17 @@ static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
>>      seg.attr.bytes = ctxt.ldtr_arbytes;
>>      hvm_set_segment_register(v, x86_seg_ldtr, &seg);
>>  
>> +    v->fpu_initialised = !!(ctxt.flags & XEN_X86_FPU_INITIALISED);
>>      /* In case xsave-absent save file is restored on a xsave-capable host */
>> -    if ( cpu_has_xsave && !xsave_enabled(v) )
>> +    if ( cpu_has_xsave && !xsave_enabled(v) && v->fpu_initialised )
> 
> Hmm, didn't I pretty explicitly ask for this to become
> 
>     if ( !v->fpu_initialised )
>         memset();

I don't think this is possible with the current code.

Sadly the XSTATE stuff is kind of messy IMHO. vcpu_init_fpu calls
xstate_alloc_save_area which on a XSAVE capable CPUs allocates _and_
initializes the FPU registers, while on non-XSAVE capable CPUs
vcpu_init_fpu just allocates the FPU memory, but doesn't initialize the
registers.

So either xstate_alloc_save_area also sets v->fpu_initialised = 1 (this
is the simplest solution), or xstate_alloc_save_area is reworked so it
only allocates the XSAVE area, but doesn't initialize it. Then XSAVE
area initialization should be done in vcpu_restore_fpu_lazy.

Roger.

  reply	other threads:[~2015-11-27 16:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 15:18 [PATCH v4 0/4] Introduce a flags field to HVM CPU context Roger Pau Monne
2015-11-25 15:18 ` [PATCH v4 1/4] xen/save: pass a size parameter to the HVM compat functions Roger Pau Monne
2015-11-25 15:18 ` [PATCH v4 2/4] xen/save: allow the usage of zeroextend and a fixup function Roger Pau Monne
2015-11-25 15:18 ` [PATCH v4 3/4] xen/hvm: introduce a flags field in the CPU save record Roger Pau Monne
2015-11-26 14:32   ` Jan Beulich
2015-11-27 16:15     ` Roger Pau Monné [this message]
2015-11-30 10:08       ` Jan Beulich
2015-11-25 15:18 ` [PATCH v4 4/4] 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=56588186.4080405@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@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.