[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |