All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Stefan ISAILA <aisaila@bitdefender.com>
To: "JBeulich@suse.com" <JBeulich@suse.com>
Cc: "andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
	"paul.durrant@citrix.com" <paul.durrant@citrix.com>,
	"Ian.Jackson@eu.citrix.com" <Ian.Jackson@eu.citrix.com>,
	"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v11 07/11] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func
Date: Fri, 13 Jul 2018 11:14:45 +0000	[thread overview]
Message-ID: <1531480485.5063.9.camel@bitdefender.com> (raw)
In-Reply-To: <5B48801B02000078001D3C1F@prv1-mh.provo.novell.com>

On Vi, 2018-07-13 at 04:34 -0600, Jan Beulich wrote:
> > 
> > > 
> > > > 
> > > > On 13.07.18 at 11:04, <aisaila@bitdefender.com> wrote:
> > --- a/xen/arch/x86/hvm/viridian.c
> > +++ b/xen/arch/x86/hvm/viridian.c
> > @@ -1026,20 +1026,26 @@ static int viridian_load_domain_ctxt(struct
> > domain *d, hvm_domain_context_t *h)
> >  HVM_REGISTER_SAVE_RESTORE(VIRIDIAN_DOMAIN,
> > viridian_save_domain_ctxt,
> >                            viridian_load_domain_ctxt, 1,
> > HVMSR_PER_DOM);
> >  
> > -static int viridian_save_vcpu_ctxt(struct domain *d,
> > hvm_domain_context_t *h)
> > +static int viridian_save_vcpu_ctxt_one(struct vcpu *v,
> > hvm_domain_context_t *h)
> >  {
> > -    struct vcpu *v;
> > +    struct hvm_viridian_vcpu_context ctxt;
> >  
> > -    if ( !is_viridian_domain(d) )
> > +    if ( !is_viridian_domain(v->domain) )
> >          return 0;
> >  
> > -    for_each_vcpu( d, v ) {
> > -        struct hvm_viridian_vcpu_context ctxt = {
> > -            .vp_assist_msr = v-
> > >arch.hvm_vcpu.viridian.vp_assist.msr.raw,
> > -            .vp_assist_pending = v-
> > >arch.hvm_vcpu.viridian.vp_assist.pending,
> > -        };
> > +    memset(&ctxt, 0, sizeof(ctxt));
> > +    ctxt.vp_assist_msr = v-
> > >arch.hvm_vcpu.viridian.vp_assist.msr.raw;
> > +    ctxt.vp_assist_pending = v-
> > >arch.hvm_vcpu.viridian.vp_assist.pending;
> >  
> > -        if ( hvm_save_entry(VIRIDIAN_VCPU, v->vcpu_id, h, &ctxt)
> > != 0 )
> > +    return hvm_save_entry(VIRIDIAN_VCPU, v->vcpu_id, h, &ctxt);
> So you now hand on the return value here, but just to ...
> 
> > 
> > +}
> > +
> > +static int viridian_save_vcpu_ctxt(struct domain *d,
> > hvm_domain_context_t *h)
> > +{
> > +    struct vcpu *v;
> > +
> > +    for_each_vcpu( d, v ) {
> > +        if ( viridian_save_vcpu_ctxt_one(v, h) != 0 )
> >              return 1;
> ... not pass it on here. Is that really what we want? The vMCE case
> does
> it differently, for example. Which means - there are certainly
> inconsistencies right now, but since you have to touch all of this
> anyway,
> couldn't you make things end in a more consistent shape after this
> rework?

In the past there where either returning the value
from hvm_save_entry()(like in the hvm_save_tsc_adjust) or check the
return value(like in the hvm_save_cpu_ctxt ) like it did here. I made
all the save_one funcs return the value from  hvm_save_entry() and then
check it in the save func so that they all return in the same way.

I don't say that the old way was bad but it was not consistent.

And yes I have missed the if() check int he save func in the vmce but I
think it's better to have the check in place there and have all the
save / save_one funcs consistent.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-07-13 11:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13  9:03 [PATCH v11 00/11] x86/domctl: Save info for one vcpu instance Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 01/11] x86/cpu: Introduce vmce_save_vcpu_ctxt_one() func Alexandru Isaila
2018-07-13 10:29   ` Jan Beulich
2018-07-13 11:19     ` Alexandru Stefan ISAILA
2018-07-13 11:50       ` Jan Beulich
2018-07-13  9:04 ` [PATCH v11 02/11] x86/hvm: Introduce hvm_save_tsc_adjust_one() func Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 03/11] x86/hvm: Introduce hvm_save_cpu_ctxt_one func Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 04/11] x86/hvm: Introduce hvm_save_cpu_xsave_states_one Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 05/11] x86/hvm: Introduce hvm_save_cpu_msrs_one func Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 06/11] x86/hvm: Introduce hvm_save_mtrr_msr_one func Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 07/11] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func Alexandru Isaila
2018-07-13 10:34   ` Jan Beulich
2018-07-13 11:14     ` Alexandru Stefan ISAILA [this message]
2018-07-13 11:53       ` Jan Beulich
2018-07-13 13:35         ` Alexandru Stefan ISAILA
2018-07-13  9:04 ` [PATCH v11 08/11] x86/hvm: Add handler for save_one funcs Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 09/11] x86/domctl: Don't pause the whole domain if only getting vcpu state Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 10/11] x86/hvm: Remove redundant save functions Alexandru Isaila
2018-07-13  9:04 ` [PATCH v11 11/11] x86/hvm: Remove save_one handler Alexandru Isaila

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=1531480485.5063.9.camel@bitdefender.com \
    --to=aisaila@bitdefender.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.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.