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 v6 1/2] xen/hvm: introduce a flags field in the CPU save record
Date: Tue, 12 Jan 2016 18:49:40 +0100	[thread overview]
Message-ID: <56953CB4.6030806@citrix.com> (raw)
In-Reply-To: <5695388802000078000C6062@prv-mh.provo.novell.com>

El 12/01/16 a les 17.31, Jan Beulich ha escrit:
>>>> On 12.01.16 at 17:12, <roger.pau@citrix.com> 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."

Thanks, Roger.

  reply	other threads:[~2016-01-12 17:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 16:12 [PATCH v6 0/2] Introduce a flags field to HVM CPU context Roger Pau Monne
2016-01-12 16:12 ` [PATCH v6 1/2] xen/hvm: introduce a flags field in the CPU save record Roger Pau Monne
2016-01-12 16:31   ` Jan Beulich
2016-01-12 17:49     ` Roger Pau Monné [this message]
2016-01-13 10:52       ` Jan Beulich
2016-01-12 16:12 ` [PATCH v6 2/2] 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=56953CB4.6030806@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.