From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: List of unaccessible x86 states Date: Mon, 26 Oct 2009 12:09:25 +0200 Message-ID: <4AE57555.7000602@redhat.com> References: <4ADDB49B.3010101@siemens.com> <4AE2055A.3050001@web.de> <9D81B6EA-7161-4682-8685-79928C0AC2B3@suse.de> <4AE41F2F.2050700@redhat.com> <20091026091731.GF5326@amd.com> <4AE56A08.5090306@redhat.com> <20091026093020.GG5326@amd.com> <4AE56E62.2050509@redhat.com> <20091026095649.GH5326@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexander Graf , Jan Kiszka , kvm-devel list , Marcelo Tosatti , Gleb Natapov To: Joerg Roedel Return-path: Received: from mx1.redhat.com ([209.132.183.28]:13300 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755477AbZJZKJ3 (ORCPT ); Mon, 26 Oct 2009 06:09:29 -0400 In-Reply-To: <20091026095649.GH5326@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: On 10/26/2009 11:56 AM, Joerg Roedel wrote: > On Mon, Oct 26, 2009 at 11:39:46AM +0200, Avi Kivity wrote: > >> On 10/26/2009 11:30 AM, Joerg Roedel wrote: >> >>> >>>> Which host state? As far as I can tell, it can all be regenerated. >>>> >>> The state which is loaded into the vcpu when a #vmexit is emulated. This >>> includes segments, control registers and the host rip for example. >>> >> All of this state does not change between nested guest and normal >> guest mode. >> > I am talking about all the state that is saved in svm->nested.hsave. > When we migrate a guest vcpu while it is running in guest mode itself > (without forcing a nested #vmexit) this state is required when a #vmexit > needs to be emulated on this vcpu after migration. > Same is true for the nested intercept conditions. > The state that is saved by VMRUN can be saved to guest memory and migrated. Extra state (like the intercepts for the previous mode) must be saved to host memory and not migrated; host intercepts can be regenerated. Concretely: hsave->save.es = vmcb->save.es; hsave->save.cs = vmcb->save.cs; hsave->save.ss = vmcb->save.ss; hsave->save.ds = vmcb->save.ds; hsave->save.gdtr = vmcb->save.gdtr; hsave->save.idtr = vmcb->save.idtr; hsave->save.efer = svm->vcpu.arch.shadow_efer; hsave->save.cr0 = svm->vcpu.arch.cr0; hsave->save.cr4 = svm->vcpu.arch.cr4; hsave->save.rflags = vmcb->save.rflags; hsave->save.rip = svm->next_rip; hsave->save.rsp = vmcb->save.rsp; hsave->save.rax = vmcb->save.rax; if (npt_enabled) hsave->save.cr3 = vmcb->save.cr3; else hsave->save.cr3 = svm->vcpu.arch.cr3; Can all be saved to guest memory. copy_vmcb_control_area(hsave, vmcb); Must not be saved into guest memory. On the other hand, it is not needed for migration. -- error compiling committee.c: too many arguments to function