Now that neither free_nested() nor vmx_vcpu_free() relies on vmcs01 being the active VMCS, don't bother switching to L1 and thus vmcs01 when freeing nested state. Temporarily keep the vcpu_{load,put}() pair even though the only reason the vCPU needed to be loaded was to be able to do vmx_switch_vmcs(), as there was at least one *known* side effect of doing vcpu_load() that KVM was subtly relying on (taking the vCPU off the PI wakeup list). I.e. defer dropping the superfluous load+put to a separate patch so that there's a dedicated bisection point if there are more lurking dependencies. Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/nested.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 553915015a75..4a8f57eb3277 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -393,19 +393,9 @@ static void nested_vmx_do_vmxoff(struct kvm_vcpu *vcpu) free_nested(vcpu); } -/* - * Ensure that the current vmcs of the logical processor is the - * vmcs01 of the vcpu before calling free_nested(). - */ void nested_vmx_free_vcpu(struct kvm_vcpu *vcpu) { - struct vcpu_vmx *vmx = to_vmx(vcpu); - vcpu_load(vcpu); - if (is_guest_mode(vcpu)) { - leave_guest_mode(vcpu); - vmx_switch_vmcs(vcpu, &vmx->vmcs01); - } free_nested(vcpu); vcpu_put(vcpu); } -- 2.56.0.385.gac671c819a-goog