]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
KVM: vmx: track host_state.loaded using a loaded_vmcs pointer
authorSean Christopherson <sean.j.christopherson@intel.com>
Mon, 23 Jul 2018 19:32:42 +0000 (12:32 -0700)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:46:47 +0000 (19:46 -0600)
commit8a12167a42c26e24e05217cd4914f093901165d2
tree7a2485cdc18a3fe1785d0a484ad830a3382e4dde
parentcf72d79f2fa55a3680b9cb9621361e6eadba8809
KVM: vmx: track host_state.loaded using a loaded_vmcs pointer

BugLink: https://bugs.launchpad.net/bugs/1835972
[ Upstream commit bd9966de4e14fb559e89a06f7f5c9aab2cc028b9 ]

Using 'struct loaded_vmcs*' to track whether the CPU registers
contain host or guest state kills two birds with one stone.

  1. The (effective) boolean host_state.loaded is poorly named.
     It does not track whether or not host state is loaded into
     the CPU registers (which most readers would expect), but
     rather tracks if host state has been saved AND guest state
     is loaded.

  2. Using a loaded_vmcs pointer provides a more robust framework
     for the optimized guest/host state switching, especially when
     consideration per-VMCS enhancements.  To that end, WARN_ONCE
     if we try to switch to host state with a different VMCS than
     was last used to save host state.

Resolve an occurrence of the new WARN by setting loaded_vmcs after
the call to vmx_vcpu_put() in vmx_switch_vmcs().

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
arch/x86/kvm/vmx.c