OSDN Git Service

KVM: nVMX: Drop redundant VMCS switch and free_nested() call
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 23 Sep 2020 18:44:51 +0000 (11:44 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 28 Sep 2020 11:57:46 +0000 (07:57 -0400)
Remove the explicit switch to vmcs01 and the call to free_nested() in
nested_vmx_free_vcpu().  free_nested(), which is called unconditionally
by vmx_leave_nested(), ensures vmcs01 is loaded prior to freeing vmcs02
and friends.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200923184452.980-7-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/nested.c

index 33c25ec..bfd69fc 100644 (file)
@@ -326,8 +326,6 @@ void nested_vmx_free_vcpu(struct kvm_vcpu *vcpu)
 {
        vcpu_load(vcpu);
        vmx_leave_nested(vcpu);
-       vmx_switch_vmcs(vcpu, &to_vmx(vcpu)->vmcs01);
-       free_nested(vcpu);
        vcpu_put(vcpu);
 }