From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 20/30] nVMX: Exiting from L2 to L1 Date: Mon, 09 May 2011 13:45:00 +0300 Message-ID: <4DC7C5AC.9030206@redhat.com> References: <1304842511-nyh@il.ibm.com> <201105080825.p488PTBq018287@rice.haifa.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, gleb@redhat.com To: "Nadav Har'El" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:8189 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751850Ab1EIKpG (ORCPT ); Mon, 9 May 2011 06:45:06 -0400 In-Reply-To: <201105080825.p488PTBq018287@rice.haifa.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/08/2011 11:25 AM, Nadav Har'El wrote: > This patch implements nested_vmx_vmexit(), called when the nested L2 guest > exits and we want to run its L1 parent and let it handle this exit. > > Note that this will not necessarily be called on every L2 exit. L0 may decide > to handle a particular exit on its own, without L1's involvement; In that > case, L0 will handle the exit, and resume running L2, without running L1 and > without calling nested_vmx_vmexit(). The logic for deciding whether to handle > a particular exit in L1 or in L0, i.e., whether to call nested_vmx_vmexit(), > will appear in the next patch. > > > /* > + * prepare_vmcs12 is part of what we need to do when the nested L2 guest exits > + * and we want to prepare to run its L1 parent. L1 keeps a vmcs for L2 (vmcs12), > + * and this function updates it to reflect the changes to the guest state while > + * L2 was running (and perhaps made some exits which were handled directly by L0 > + * without going back to L1), and to reflect the exit reason. > + * Note that we do not have to copy here all VMCS fields, just those that > + * could have changed by the L2 guest or the exit - i.e., the guest-state and > + * exit-information fields only. Other fields are modified by L1 with VMWRITE, > + * which already writes to vmcs12 directly. > + */ > +void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) > +{ > + vmcs12->vmcs_link_pointer = vmcs_read64(VMCS_LINK_POINTER); Again, this should be emulated, not assigned to the guest. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.