From: Krish Sadhukhan <krish.sadhukhan@oracle.com>
To: "Sean Christopherson" <sean.j.christopherson@intel.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Cc: kvm@vger.kernel.org, Karl Heubaum <karl.heubaum@oracle.com>,
Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH v6 3/7] KVM: nVMX: Move guest non-reg state checks to VM-Exit path
Date: Thu, 11 Apr 2019 14:00:25 -0700 [thread overview]
Message-ID: <fc0e7a3f-4ccf-4da4-e5ae-0d5e5b145739@oracle.com> (raw)
In-Reply-To: <20190411191809.8131-4-sean.j.christopherson@intel.com>
On 04/11/2019 12:18 PM, Sean Christopherson wrote:
> Per Intel's SDM, volume 3, section Checking and Loading Guest State:
>
> Because the checking and the loading occur concurrently, a failure may
> be discovered only after some state has been loaded. For this reason,
> the logical processor responds to such failures by loading state from
> the host-state area, as it would for a VM exit.
>
> In other words, a failed non-register state consistency check results in
> a VM-Exit, not VM-Fail. Moving the non-reg state checks also paves the
> way for renaming nested_vmx_check_vmentry_postreqs() to align with the
> SDM, i.e. nested_vmx_check_vmentry_guest_state().
>
> Fixes: 26539bd0e446a ("KVM: nVMX: check vmcs12 for valid activity state")
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> arch/x86/kvm/vmx/nested.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index f487aae3233e..fe1323ab6894 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -2612,18 +2612,6 @@ static int nested_check_host_control_regs(struct kvm_vcpu *vcpu,
> return 0;
> }
>
> -/*
> - * Checks related to Guest Non-register State
> - */
> -static int nested_check_guest_non_reg_state(struct vmcs12 *vmcs12)
> -{
> - if (vmcs12->guest_activity_state != GUEST_ACTIVITY_ACTIVE &&
> - vmcs12->guest_activity_state != GUEST_ACTIVITY_HLT)
> - return -EINVAL;
> -
> - return 0;
> -}
> -
> static int nested_vmx_check_vmentry_prereqs(struct kvm_vcpu *vcpu,
> struct vmcs12 *vmcs12)
> {
> @@ -2635,9 +2623,6 @@ static int nested_vmx_check_vmentry_prereqs(struct kvm_vcpu *vcpu,
> if (nested_check_host_control_regs(vcpu, vmcs12))
> return VMXERR_ENTRY_INVALID_HOST_STATE_FIELD;
>
> - if (nested_check_guest_non_reg_state(vmcs12))
> - return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
> -
> return 0;
> }
>
> @@ -2668,6 +2653,18 @@ static int nested_vmx_check_vmcs_link_ptr(struct kvm_vcpu *vcpu,
> return r;
> }
>
> +/*
> + * Checks related to Guest Non-register State
> + */
> +static int nested_check_guest_non_reg_state(struct vmcs12 *vmcs12)
> +{
> + if (vmcs12->guest_activity_state != GUEST_ACTIVITY_ACTIVE &&
> + vmcs12->guest_activity_state != GUEST_ACTIVITY_HLT)
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> static int nested_vmx_check_vmentry_postreqs(struct kvm_vcpu *vcpu,
> struct vmcs12 *vmcs12,
> u32 *exit_qual)
> @@ -2713,6 +2710,9 @@ static int nested_vmx_check_vmentry_postreqs(struct kvm_vcpu *vcpu,
> (vmcs12->guest_bndcfgs & MSR_IA32_BNDCFGS_RSVD)))
> return 1;
>
> + if (nested_check_guest_non_reg_state(vmcs12))
> + return 1;
> +
> return 0;
> }
>
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
next prev parent reply other threads:[~2019-04-11 21:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-11 19:18 [PATCH v6 0/7] KVM: nVMX Add IA32_PAT consistency checks Sean Christopherson
2019-04-11 19:18 ` [PATCH v6 1/7] Check "load IA32_PAT" VM-exit control on vmentry Sean Christopherson
2019-04-11 19:18 ` [PATCH v6 2/7] Check "load IA32_PAT" VM-entry " Sean Christopherson
2019-04-11 19:18 ` [PATCH v6 3/7] KVM: nVMX: Move guest non-reg state checks to VM-Exit path Sean Christopherson
2019-04-11 21:00 ` Krish Sadhukhan [this message]
2019-04-11 19:18 ` [PATCH v6 4/7] KVM: nVMX: Rename and split top-level consistency checks to match SDM Sean Christopherson
2019-04-11 21:23 ` Krish Sadhukhan
2019-04-11 19:18 ` [PATCH v6 5/7] KVM: nVMX: Set VM-{Fail,Exit} failure info via params, not return val Sean Christopherson
2019-04-11 21:56 ` Krish Sadhukhan
2019-04-12 8:30 ` Paolo Bonzini
2019-04-12 19:12 ` Sean Christopherson
2019-04-11 19:18 ` [PATCH v6 6/7] KVM: nVMX: Collapse nested_check_host_control_regs() into its caller Sean Christopherson
2019-04-11 22:02 ` Krish Sadhukhan
2019-04-11 19:18 ` [PATCH v6 7/7] KVM: nVMX: Return -EINVAL when signaling failure in VM-Entry helpers Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc0e7a3f-4ccf-4da4-e5ae-0d5e5b145739@oracle.com \
--to=krish.sadhukhan@oracle.com \
--cc=jmattson@google.com \
--cc=karl.heubaum@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox