xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <Paul.Durrant@citrix.com>
To: Andrew Cooper <Andrew.Cooper3@citrix.com>,
	'Jan Beulich' <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] x86/HVM: improve a few state load checks
Date: Mon, 16 Jul 2018 14:09:06 +0000	[thread overview]
Message-ID: <fe4a878264854927a868b6073338b391@AMSPEX02CL02.citrite.net> (raw)
In-Reply-To: <80d53b0d-e736-8d5e-f89d-9cbcd20fe9f4@citrix.com>

> -----Original Message-----
> From: Andrew Cooper
> Sent: 16 July 2018 15:08
> To: Paul Durrant <Paul.Durrant@citrix.com>; 'Jan Beulich'
> <JBeulich@suse.com>; xen-devel <xen-devel@lists.xenproject.org>
> Subject: Re: [PATCH] x86/HVM: improve a few state load checks
> 
> On 16/07/18 15:05, Paul Durrant wrote:
> >> --- a/xen/arch/x86/hvm/hvm.c
> >> +++ b/xen/arch/x86/hvm/hvm.c
> >> @@ -976,14 +976,13 @@ unsigned long hvm_cr4_guest_valid_bits(c
> >>
> >>  static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t
> *h)
> >>  {
> >> -    int vcpuid;
> >> +    unsigned int vcpuid = hvm_load_instance(h);
> >>      struct vcpu *v;
> >>      struct hvm_hw_cpu ctxt;
> >>      struct segment_register seg;
> >>      const char *errstr;
> >>
> >>      /* Which vcpu is this? */
> >> -    vcpuid = hvm_load_instance(h);
> >>      if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
> > This open coded pattern:
> >
> > vcpuid = hvm_load_instance(h);
> > if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
> > { ...
> >
> > seems to be repeated an awful lot. Is it time, perhaps, to introduce a
> helper function that incorporates the check?
> 
> In some copious free time when I can post v2 of my "fix max_vcpus"
> series, all of this logic (and much more) will become redundant and get
> culled.
> 
> I really wouldn't waste time re-factoring it at this point.

Ok. If that's the case then...

Reviewed-by: Paul Durrant <paul.durrant@citrix.com>

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

      reply	other threads:[~2018-07-16 14:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 13:58 [PATCH] x86/HVM: improve a few state load checks Jan Beulich
2018-07-16 14:01 ` Andrew Cooper
2018-07-16 14:05 ` Paul Durrant
2018-07-16 14:07   ` Andrew Cooper
2018-07-16 14:09     ` Paul Durrant [this message]

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=fe4a878264854927a868b6073338b391@AMSPEX02CL02.citrite.net \
    --to=paul.durrant@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=JBeulich@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).