[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



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


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