On 14/02/2017 23:17, Jim Mattson wrote: > 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). Looks like that, yes. I went for "from_vmentry" because I wasn't sure if your missing patch was just reverting this: commit 7af40ad37b3f097f367cbe9c0198caccce6fd83b Author: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> Date: Sat Jan 4 18:47:23 2014 +0100 KVM: nVMX: Fix nested_run_pending on activity state HLT When we suspend the guest in HLT state, the nested run is no longer pending - we emulated it completely. So only set nested_run_pending after checking the activity state. Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> I guess it would be possible to reset nested_run_pending on activity state HLT, too, but I didn't feel like mangling your patches even more. Paolo