[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 3/4] xen/hvm: introduce a flags field in the CPU save record



>>> On 27.11.15 at 17:15, <roger.pau@xxxxxxxxxx> wrote:
> El 26/11/15 a les 15.32, Jan Beulich ha escrit:
>>>>> On 25.11.15 at 16:18, <roger.pau@xxxxxxxxxx> 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.

Agreed.

> 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.

Well, I can't see registers being initialized. All I can see is MXCSR
and FCW getting values set in the memory image, which I suppose
is what you meant. But that can be easily mirrored here (which
then would also get closer to what hvm_vcpu_reset_state() does).

> 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.

Re-working along those lines certainly is also an option.

Jan


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.