All of lore.kernel.org
 help / color / mirror / Atom feed
From: Isaila Alexandru <aisaila@bitdefender.com>
To: Jan Beulich <JBeulich@suse.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 v15 09/14] x86/hvm: Introduce lapic_save_regs_one func
Date: Tue, 07 Aug 2018 15:37:05 +0300	[thread overview]
Message-ID: <1533645425.23883.1.camel@bitdefender.com> (raw)
In-Reply-To: <5B698BFB02000078001DB894@prv1-mh.provo.novell.com>

On Ma, 2018-08-07 at 06:09 -0600, Jan Beulich wrote:
> > 
> > > 
> > > > 
> > > > On 03.08.18 at 15:53, <aisaila@bitdefender.com> wrote:
> > This is used to save data from a single instance.
> > 
> > Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
> > ---
> >  xen/arch/x86/hvm/vlapic.c | 27 +++++++++++++++++++--------
> >  1 file changed, 19 insertions(+), 8 deletions(-)
> > 
> > diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
> > index 0795161..d35810e 100644
> > --- a/xen/arch/x86/hvm/vlapic.c
> > +++ b/xen/arch/x86/hvm/vlapic.c
> > @@ -1460,26 +1460,37 @@ static int lapic_save_hidden(struct domain
> > *d, 
> > hvm_domain_context_t *h)
> >      return err;
> >  }
> >  
> > +static int lapic_save_regs_one(struct vcpu *v,
> > hvm_domain_context_t *h)
> > +{
> > +    struct vlapic *s;
> > +
> > +    if ( !has_vlapic(v->domain) )
> > +        return 0;
> > +
> > +    if ( hvm_funcs.sync_pir_to_irr )
> > +        hvm_funcs.sync_pir_to_irr(v);
> > +
> > +    s = vcpu_vlapic(v);
> > +
> > +    return hvm_save_entry(LAPIC_REGS, v->vcpu_id, h, s->regs);
> > +}
> Here as well as in patch 8 there's little point in having a local
> variable s
> which is used just once. If you really think you want to retain them,
> here it can be pointer to const (other than in patch 8 afaict), and
> like
> in patch 8 it could have an initializer instead of later having a
> separate
> assignment statement.
> 
> > 
> >  static int lapic_save_regs(struct domain *d, hvm_domain_context_t
> > *h)
> >  {
> >      struct vcpu *v;
> > -    struct vlapic *s;
> > -    int rc = 0;
> > +    int err = 0;
> >  
> >      if ( !has_vlapic(d) )
> >          return 0;
> >  
> >      for_each_vcpu ( d, v )
> >      {
> > -        if ( hvm_funcs.sync_pir_to_irr )
> > -            hvm_funcs.sync_pir_to_irr(v);
> > -
> > -        s = vcpu_vlapic(v);
> > -        if ( (rc = hvm_save_entry(LAPIC_REGS, v->vcpu_id, h, s-
> > >regs)) != 0 )
> > +        err = lapic_save_regs_one(v, h);
> > +        if ( err )
> >              break;
> >      }
> >  
> > -    return rc;
> > +    return err;
> >  }
> Since the whole function is meant to go away anyway, it doesn't
> matter much, but why did you see a need to replace "rc" by "err"?
> This only increases code churn (even if just slightly). IOW: No
> need to change this, but something to consider in the future.
> 
Err was just to have all the functions work with the same variable name
so this was done just for consistency.

Alex

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

  reply	other threads:[~2018-08-07 12:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 13:53 [PATCH v15 00/14] x86/domctl: Save info for one vcpu instance Alexandru Isaila
2018-08-03 13:53 ` [PATCH v15 01/14] x86/cpu: Introduce vmce_save_vcpu_ctxt_one() func Alexandru Isaila
2018-08-03 13:53 ` [PATCH v15 02/14] x86/hvm: Introduce hvm_save_tsc_adjust_one() func Alexandru Isaila
2018-08-03 13:53 ` [PATCH v15 03/14] x86/hvm: Introduce hvm_save_cpu_ctxt_one func Alexandru Isaila
2018-08-03 13:53 ` [PATCH v15 04/14] x86/hvm: Introduce hvm_save_cpu_xsave_states_one Alexandru Isaila
2018-08-03 13:53 ` [PATCH v15 05/14] x86/hvm: Introduce hvm_save_cpu_msrs_one func Alexandru Isaila
2018-08-03 13:53 ` [PATCH v15 06/14] x86/hvm: Introduce hvm_save_mtrr_msr_one func Alexandru Isaila
2018-08-07 12:00   ` Jan Beulich
2018-08-07 15:02     ` Isaila Alexandru
2018-08-07 15:11       ` Jan Beulich
2018-08-03 13:53 ` [PATCH v15 07/14] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func Alexandru Isaila
2018-08-03 13:53 ` [PATCH v15 08/14] x86/hvm: Introduce lapic_save_hidden_one Alexandru Isaila
2018-08-03 13:53 ` [PATCH v15 09/14] x86/hvm: Introduce lapic_save_regs_one func Alexandru Isaila
2018-08-07 12:09   ` Jan Beulich
2018-08-07 12:37     ` Isaila Alexandru [this message]
2018-08-03 13:53 ` [PATCH v15 10/14] x86/hvm: Add handler for save_one funcs Alexandru Isaila
2018-08-03 13:53 ` [PATCH v15 11/14] x86/domctl: Use hvm_save_vcpu_handler Alexandru Isaila
2018-08-07 12:25   ` Jan Beulich
2018-08-03 13:53 ` [PATCH v15 12/14] x86/hvm: Drop the use of save functions Alexandru Isaila
2018-08-07 12:28   ` Jan Beulich
2018-08-07 12:41   ` Jan Beulich
2018-08-03 13:53 ` [PATCH v15 13/14] x86/hvm: Remove redundant " Alexandru Isaila
2018-08-07 12:47   ` Jan Beulich
2018-08-03 13:53 ` [PATCH v15 14/14] x86/domctl: Don't pause the whole domain if only getting vcpu state Alexandru Isaila
2018-08-07 12:58   ` Jan Beulich
2018-08-07 12:59 ` [PATCH v15 00/14] x86/domctl: Save info for one vcpu instance 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=1533645425.23883.1.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.