All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: aisaila@bitdefender.com
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Paul Durrant <paul.durrant@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH v4 2/2] x86/domctl: Don't pause the whole domain if only getting vcpu state
Date: Fri, 18 May 2018 09:01:58 -0600	[thread overview]
Message-ID: <5AFEEAE602000078001C41E6@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <5AFDA80602000078001C3BF2@prv1-mh.provo.novell.com>

>>> On 17.05.18 at 18:04, <JBeulich@suse.com> wrote:
>>>> On 07.05.18 at 10:24, <aisaila@bitdefender.com> wrote:
>> --- a/xen/arch/x86/cpu/mcheck/vmce.c
>> +++ b/xen/arch/x86/cpu/mcheck/vmce.c
>> @@ -357,20 +357,14 @@ void vmce_save_vcpu_ctxt_one(struct vcpu *v, struct hvm_vmce_vcpu *ctxt)
>>      ctxt->mcg_ext_ctl = v->arch.vmce.mcg_ext_ctl;
>>  }
>>  
>> -static int vmce_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
>> +static int vmce_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h,
>> +                               struct vcpu *v)
>>  {
>> -    struct vcpu *v;
>>      int err = 0;
>> +    struct hvm_vmce_vcpu ctxt;
>>  
>> -    for_each_vcpu ( d, v )
>> -    {
>> -        struct hvm_vmce_vcpu ctxt;
>> -
>> -        vmce_save_vcpu_ctxt_one(v, &ctxt);
>> -        err = hvm_save_entry(VMCE_VCPU, v->vcpu_id, h, &ctxt);
>> -        if ( err )
>> -            break;
>> -    }
>> +    vmce_save_vcpu_ctxt_one(v, &ctxt);
>> +    err = hvm_save_entry(VMCE_VCPU, v->vcpu_id, h, &ctxt);
>>  
>>      return err;
>>  }
> 
> At the example of this one: The idea of breaking out the patch introducing
> the _one() functions was to avoid restructuring in this patch like what you
> do here. Any such change not strictly fitting under the title of this patch
> should be broken out. There may be multiple steps involved here.
> 
> As it stands, the function is now no longer meaningfully different from
> vmce_save_vcpu_ctxt_one(), and this pattern recurs. Such redundancy
> is undesirable. Together with you now passing v and d (when just v
> would suffice) I think you want to further re-structure how handling of
> save/restore happens, such that no stub functions like the one here
> remain. IOW after having introduced the _one() functions, a second
> transformation would be expected to eliminate the original ones, with
> (as you do here) the loop moving into the caller.

I think I should further clarify this reply of mine: The goal of the
transformation should be that in the end we continue to have a single
load and a single save function for every save type. These should be
referenced by HVM_REGISTER_SAVE_RESTORE() or whatever clone of
it may turn out necessary (note how its uses currently specify
HVMSR_PER_VCPU, which may in the end no longer be necessary).
That will also make the asymmetry go away that the save functions
currently iterate over all vCPU-s, while the load functions don't (it'll
presumably remain to be that way for multi-instance types where it's
not the vCPU that is determining the instance, like the PIC).

Ideally save functions would further match load ones by the caller
specifying the instance. Suitable unique return values may need to be
used to signal the caller when to end the iteration. For example, the
functions could return a "next instance" indicator. (I think you agree
that this is an unavoidable difference to the load functions, where the
instance comes with the load record.)

In any event, just to re-iterate - the final patch under this title should
preferably not have a need to touch any of the save functions; all of
this should be done in prereq changes. That'll then allow to focus on
just the specific bit of new behavior you want when reviewing this
(presumably last) patch of the series.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-05-18 15:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-07  8:24 [PATCH v4 1/2] x86/hvm: Introduce *save_one() functions Alexandru Isaila
2018-05-07  8:24 ` [PATCH v4 2/2] x86/domctl: Don't pause the whole domain if only getting vcpu state Alexandru Isaila
2018-05-17 16:04   ` Jan Beulich
2018-05-18 15:01     ` Jan Beulich [this message]
2018-05-17 15:49 ` [PATCH v4 1/2] x86/hvm: Introduce *save_one() functions Jan Beulich

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=5AFEEAE602000078001C41E6@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=aisaila@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=paul.durrant@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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.