On Fri, Jan 25, 2019 at 7:41 AM Sean Christopherson <sean.j.christopherson@xxxxxxxxx> wrote: > > Temporarily propagating vmx->loaded_vmcs->launched to vmx->__launched > is not functionally necessary, but rather was done historically to > avoid passing both 'vmx' and 'loaded_vmcs' to the vCPU-run asm blob. > Nested early checks inherited this behavior by virtue of copy+paste. > > A future patch will move HOST_RSP caching to be per-VMCS, i.e. store > 'host_rsp' in loaded VMCS. Now that the reference to 'vmx->fail' is > also gone from nested early checks, referencing 'loaded_vmcs' directly > means we can drop the 'vmx' reference when introducing per-VMCS RSP > caching. And it means __launched can be dropped from struct vcpu_vmx > if/when vCPU-run receives similar treatment. > > Note the use of a named register constraint for 'loaded_vmcs'. Using > RCX to hold 'vmx' was inherited from vCPU-run. In the vCPU-run case, > the scratch register needs to be explicitly defined as it is crushed > when loading guest state, i.e. deferring to the compiler would corrupt > the pointer. Since nested early checks never loads guests state, it's > a-ok to let the compiler pick any register. Naming the constraint > avoids the fragility of referencing constraints via %1, %2, etc.., which > breaks horribly when modifying constraints, and generally makes the asm > blob more readable. > > Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>