[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86/HVM: improve a few state load checks


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>, 'Jan Beulich' <JBeulich@xxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Paul Durrant <Paul.Durrant@xxxxxxxxxx>
  • Date: Mon, 16 Jul 2018 14:09:06 +0000
  • Accept-language: en-GB, en-US
  • Delivery-date: Mon, 16 Jul 2018 14:09:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHUHQ0WFsQN6UKnw0WzNc7ImzQcLKSR4VDg///fxoCAACHBQA==
  • Thread-topic: [PATCH] x86/HVM: improve a few state load checks

> -----Original Message-----
> From: Andrew Cooper
> Sent: 16 July 2018 15:08
> To: Paul Durrant <Paul.Durrant@xxxxxxxxxx>; 'Jan Beulich'
> <JBeulich@xxxxxxxx>; xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
> 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@xxxxxxxxxx>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.