From: Tim Deegan Subject: Re: [PATCH 12 of 20] Add APIs to switch n1/n2 VMCS Date: Thu, 2 Jun 2011 15:50:02 +0100 Message-ID: <20110602145002.GK5098@whitby.uk.xensource.com> References: <62cc6c7516e010ef673c.1307005045@nest-wsm.los-vmm.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Return-path: Content-Disposition: inline In-Reply-To: <62cc6c7516e010ef673c.1307005045@nest-wsm.los-vmm.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Eddie Dong Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org At 16:57 +0800 on 02 Jun (1307033845), Eddie Dong wrote: > diff -r 4631a9511200 -r 62cc6c7516e0 xen/arch/x86/hvm/vmx/vmcs.c > --- a/xen/arch/x86/hvm/vmx/vmcs.c Thu Jun 02 16:33:20 2011 +0800 > +++ b/xen/arch/x86/hvm/vmx/vmcs.c Thu Jun 02 16:33:21 2011 +0800 > @@ -669,6 +669,38 @@ void vmx_disable_intercept_for_msr(struc > } > } > > +/* > + * Switch VMCS between layer 1 & 2 guest > + */ > +void vmx_vmcs_switch(struct vcpu *v, > + struct vmcs_struct *from, > + struct vmcs_struct *to) > +{ > + /* no foreign access */ > + if ( unlikely(v != current) ) > + return; > + > + if ( unlikely(current->arch.hvm_vmx.vmcs != from) ) > + return; Do you really want this function to fail silently if called with v != current? Use ASSERT(), or, even better, remove the first argument entirely. Cheers, Tim. -- Tim Deegan Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)