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

Re: [Xen-devel] [PATCH v6 1/2] xen/hvm: introduce a flags field in the CPU save record



>>> On 12.01.16 at 18:49, <roger.pau@xxxxxxxxxx> wrote:
> El 12/01/16 a les 17.31, Jan Beulich ha escrit:
>>>>> On 12.01.16 at 17:12, <roger.pau@xxxxxxxxxx> wrote:
>>> @@ -2087,19 +2100,21 @@ 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);
>>>  
>>> -    /* In case xsave-absent save file is restored on a xsave-capable host 
>>> */
>>> -    if ( cpu_has_xsave && !xsave_enabled(v) )
>>> +    v->fpu_initialised = !!(ctxt.flags & XEN_X86_FPU_INITIALISED);
>>> +    if ( v->fpu_initialised )
>>>      {
>>> -        struct xsave_struct *xsave_area = v->arch.xsave_area;
>>> +        memcpy(v->arch.fpu_ctxt, ctxt.fpu_regs, sizeof(ctxt.fpu_regs));
>>> +        /* In case xsave-absent save file is restored on a xsave-capable 
>>> host */
>>> +        if ( cpu_has_xsave && !xsave_enabled(v) )
>>> +        {
>>> +            struct xsave_struct *xsave_area = v->arch.xsave_area;
>>>  
>>> -        memcpy(v->arch.xsave_area, ctxt.fpu_regs, sizeof(ctxt.fpu_regs));
>>> -        xsave_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE;
>>> -        if ( cpu_has_xsaves || cpu_has_xsavec )
>>> -            xsave_area->xsave_hdr.xcomp_bv = XSTATE_FP_SSE |
>>> -                                             XSTATE_COMPACTION_ENABLED;
>>> +            xsave_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE;
>>> +            if ( cpu_has_xsaves || cpu_has_xsavec )
>>> +                xsave_area->xsave_hdr.xcomp_bv = XSTATE_FP_SSE |
>>> +                                                 XSTATE_COMPACTION_ENABLED;
>>> +        }
>>>      }
>>> -    else
>>> -        memcpy(v->arch.fpu_ctxt, ctxt.fpu_regs, sizeof(ctxt.fpu_regs));
>>>  
>> 
>> I would have expected this to simply be re-indentation, yet
>> you changed from if/else to just if with the else code done
>> ahead of it. If this really is intended, the commit message should
>> explain it.
> 
> Right, sorry. AFAICT v->arch.fpu_ctxt points to the xsave_area (as set
> by vcpu_init_fpu), so I though it was simpler to just do one memcpy for
> both cases, since v->arch.fpu_ctxt always points to the right area for
> either cases (and I was already modifying the code in question).
> 
> I can see that this might be seen as an unrelated change, so if you want
> I can split it into a separate patch, or add the following to the commit
> message:
> 
> "While modifying the FPU restore part of hvm_load_cpu_ctxt remove the
> memcpy branching, since v->arch.fpu_ctxt will always point to the right
> area for hosts with XSAVE or without it."

I'm fine with that commit message extension, and will be happy to
add it while committing unless a need arises for you to re-submit.

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