A VMX preemption timer value of '0' at the time of VMEnter is architecturally guaranteed to cause a VMExit prior to the CPU executing any instructions in the guest. KVM serendipitously emulates this behavior when running as L0, but doesn't ensure correct emulation when running at L1 or higher. Explicitly emulate the architectural behavior of a timer value of '0'. v1->v2: - move flag to vmx->loaded_vmcs - extract arming the timer to a separate function instead of using a boolean - clean up SVM Sean Christopherson (3): KVM: VMX: immediately mark preemption timer expired only for zero value KVM: VMX: modify preemption timer bit only when arming timer KVM: VMX: use preemption timer to force immediate VMExit arch/x86/include/asm/kvm_host.h | 2 + arch/x86/kvm/svm.c | 2 + arch/x86/kvm/vmx.c | 94 ++++++++++++++++++++++++++--------------- arch/x86/kvm/x86.c | 8 +++- 4 files changed, 70 insertions(+), 36 deletions(-) -- 1.8.3.1