From: "Jan Beulich" Subject: Re: [PATCH] x86/domain: Improvements to switch_native() and switch_compat() Date: Mon, 19 Jan 2015 11:34:14 +0000 Message-ID: <54BCF9C6020000780005666A@mail.emea.novell.com> References: <1421664282-9259-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1421664282-9259-1-git-send-email-andrew.cooper3@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Tim Deegan , Keir Fraser , Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 19.01.15 at 11:44, wrote: > To aid the cleanup in switch_compat(), release_compat_l4() is updated to > make > it safe to call on a vcpu without an existing compat l4. For this part of the change: > --- a/xen/arch/x86/domain.c > +++ b/xen/arch/x86/domain.c > @@ -349,6 +349,8 @@ static int setup_compat_l4(struct vcpu *v) > > static void release_compat_l4(struct vcpu *v) > { > + if ( pagetable_is_null(v->arch.guest_table) ) > + return; I'd rather see this check be done in the one caller that needs it, since ... > @@ -373,21 +373,16 @@ int switch_native(struct domain *d) > > d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0; > > - for ( vcpuid = 0; vcpuid < d->max_vcpus; vcpuid++ ) > - { > - if (d->vcpu[vcpuid]) > - release_compat_l4(d->vcpu[vcpuid]); > - } > + for_each_vcpu( d, v ) > + release_compat_l4(v); ... this one can't run into that situation (or the old code would have been broken). Jan