Yikes! Did I forget to include "kvm: nVMX: Set nested_run_pending before prepare_vmcs02()"? Sorry. That obviates the need for "from_vmentry," and is a little less awkward, I think. (The problem is that kvm can exit to userspace with vmx->nested.nested_run_pending set. If VMX state is saved at that time, then the restore code has to behave as if "from_vmentry" is true. In any event, your version looks fine, and I can always clean it up later (or not). After commit 06750494993be18e ("kvm: nVMX: Refactor nested_get_vmcs12_pages()"), vmx.c:9688 should read: if (vmx->nested.virtual_apic_page) { i.e., drop the '!' On Wed, Feb 8, 2017 at 8:24 AM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > > On 30/11/2016 21:03, Jim Mattson wrote: >> This series of patches introduces checkpoint and restore operations >> for the VMX state of a VM, so that VMX-capable VMs can be migrated. >> >> Two new ioctls are introduced: KVM_GET_VMX_STATE and >> KVM_SET_VMX_STATE. The VMX state that is checkpointed/restored >> consists of the VMXON region address (if any), the current VMCS >> address (if any), and the cached current VMCS contents (if any). One >> piece of implementation-specific state that is also >> checkpointed/restored is the nested_run_pending bit. >> >> On live migration, our userspace process does not have access to guest >> memory when the VM is set up on the target host, so some operations >> that require a GPA->HPA mapping are deferred until the next vcpu_run >> using a new vcpu request. > > I merged patches 1-6 into kvm/queue. Rebasing took a bit of work, so > please take a look. > > Paolo