Message ID | 20190502183125.257005-1-aaronlewis@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] kvm: nVMX: Set nested_run_pending in vmx_set_nested_state after checks complete | expand |
On Thu, May 02, 2019 at 11:31:25AM -0700, Aaron Lewis wrote: > nested_run_pending=1 implies we have successfully entered guest mode. > Move setting from external state in vmx_set_nested_state() until after > all other checks are complete. > > Signed-off-by: Aaron Lewis <aaronlewis@google.com> > Reviewed-by: Peter Shier <pshier@google.com> > --- > arch/x86/kvm/vmx/nested.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index 6401eb7ef19c..081dea6e211a 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -5460,9 +5460,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, > if (!(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) > return 0; > > - vmx->nested.nested_run_pending = > - !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING); @nested_run_pending is consumed by nested_vmx_enter_non_root_mode(), e.g. prepare_vmcs02(). I'm guessing its current location is deliberate. > - > if (nested_cpu_has_shadow_vmcs(vmcs12) && > vmcs12->vmcs_link_pointer != -1ull) { > struct vmcs12 *shadow_vmcs12 = get_shadow_vmcs12(vcpu); > @@ -5489,6 +5486,9 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, > if (ret) > return -EINVAL; > > + vmx->nested.nested_run_pending = > + !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING); > + > return 0; > } > > -- > 2.21.0.593.g511ec345e18-goog >
On 03/05/19 11:35, Sean Christopherson wrote: > @nested_run_pending is consumed by nested_vmx_enter_non_root_mode(), > e.g. prepare_vmcs02(). I'm guessing its current location is deliberate. Right. If nested_run_pending is false, for example, GUEST_BNDCFGS must not be taken from the vmcs12. Paolo
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 6401eb7ef19c..081dea6e211a 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -5460,9 +5460,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, if (!(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) return 0; - vmx->nested.nested_run_pending = - !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING); - if (nested_cpu_has_shadow_vmcs(vmcs12) && vmcs12->vmcs_link_pointer != -1ull) { struct vmcs12 *shadow_vmcs12 = get_shadow_vmcs12(vcpu); @@ -5489,6 +5486,9 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, if (ret) return -EINVAL; + vmx->nested.nested_run_pending = + !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING); + return 0; }