On Mon, Jul 23, 2018 at 12:33 PM Sean Christopherson <sean.j.christopherson@xxxxxxxxx> wrote: > > 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@xxxxxxxxx> Reviewed-by: Peter Shier <pshier@xxxxxxxxxx> Tested-by: Peter Shier <pshier@xxxxxxxxxx>