From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/5] Nested VMX patch 2 implements vmclear Date: Tue, 20 Oct 2009 13:06:40 +0900 Message-ID: <4ADD3750.1060603@redhat.com> References: <1255617706-13564-1-git-send-email-oritw@il.ibm.com> <1255617706-13564-2-git-send-email-oritw@il.ibm.com> <1255617706-13564-3-git-send-email-oritw@il.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, benami@il.ibm.com, abelg@il.ibm.com, muli@il.ibm.com, aliguori@us.ibm.com, mdday@us.ibm.com To: oritw@il.ibm.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:12033 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750795AbZJTEGo (ORCPT ); Tue, 20 Oct 2009 00:06:44 -0400 In-Reply-To: <1255617706-13564-3-git-send-email-oritw@il.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 10/15/2009 11:41 PM, oritw@il.ibm.com wrote: > From: Orit Wasserman > > --- > arch/x86/kvm/vmx.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++--- > 1 files changed, 65 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 71bd91a..411cbdb 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -61,15 +61,26 @@ module_param_named(unrestricted_guest, > static int __read_mostly emulate_invalid_guest_state = 0; > module_param(emulate_invalid_guest_state, bool, S_IRUGO); > > -struct vmcs { > - u32 revision_id; > - u32 abort; > - char data[0]; > +struct __attribute__ ((__packed__)) level_state { > + /* Has the level1 guest done vmclear? */ > + bool vmclear; > }; > Why __packed__? > > struct nested_vmx { > /* Has the level1 guest done vmxon? */ > bool vmxon; > + > + /* > + * Level 2 state : includes vmcs,registers and > + * a copy of vmcs12 for vmread/vmwrite > + */ > + struct level_state *l2_state; > +}; > + > +struct vmcs { > + u32 revision_id; > + u32 abort; > + char data[0]; > }; > Why move struct vmcs around? > + > static int handle_vmoff(struct kvm_vcpu *vcpu) > { > struct vcpu_vmx *vmx = to_vmx(vcpu); > @@ -3310,6 +3368,8 @@ static int handle_vmon(struct kvm_vcpu *vcpu) > > vmx->nested.vmxon = 1; > > + create_l2_state(vcpu); > + > Need to check return code. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.