• Sean Christopherson's avatar
    KVM: vmx: track host_state.loaded using a loaded_vmcs pointer · bd9966de
    Sean Christopherson authored
    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: default avatarSean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    bd9966de
vmx.c 391 KB