kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 3/4] KVM: nVMX: Check all exceptions for intercept during delivery to L2
Date: Wed, 25 Sep 2013 12:38:20 +0200	[thread overview]
Message-ID: <5242BD1C.1020903@redhat.com> (raw)
In-Reply-To: <1380102696-25267-4-git-send-email-gleb@redhat.com>

Il 25/09/2013 11:51, Gleb Natapov ha scritto:
> All exceptions should be checked for intercept during delivery to L2,
> but we check only #PF currently. Drop nested_run_pending while we are
> at it since exception cannot be injected during vmentry anyway.
> 
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
>  arch/x86/kvm/vmx.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 663bc5e..5bfa09d 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -1902,12 +1902,11 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
>   * a #PF exception (this is the only case in which KVM injects a #PF when L2
>   * is running).
>   */
> -static int nested_pf_handled(struct kvm_vcpu *vcpu)
> +static int nested_ex_handled(struct kvm_vcpu *vcpu, unsigned nr)
>  {
>  	struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
>  
> -	/* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */
> -	if (!(vmcs12->exception_bitmap & (1u << PF_VECTOR)))
> +	if (!(vmcs12->exception_bitmap & (1u << nr)))
>  		return 0;
>  
>  	nested_vmx_vmexit(vcpu);
> @@ -1921,8 +1920,7 @@ static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
>  	struct vcpu_vmx *vmx = to_vmx(vcpu);
>  	u32 intr_info = nr | INTR_INFO_VALID_MASK;
>  
> -	if (!reinject && nr == PF_VECTOR && is_guest_mode(vcpu) &&
> -	    !vmx->nested.nested_run_pending && nested_pf_handled(vcpu))
> +	if (!reinject && is_guest_mode(vcpu) && nested_ex_handled(vcpu, nr))

The code is now pretty similar to what svm.c does.  Do we want to move
the is_guest_mode(vcpu) check into nested_ex_handled, too?  (Or vice
versa, take it out in svm.c).  Perhaps you could also name the function
nested_vmx_check_exception.

Paolo

>  		return;
>  
>  	if (has_error_code) {
> 


  reply	other threads:[~2013-09-25 10:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25  9:51 [PATCH 0/4] Fix shadow-on-shadow nested VMX Gleb Natapov
2013-09-25  9:51 ` [PATCH 1/4] KVM: nVMX: Amend nested_run_pending logic Gleb Natapov
2013-09-25  9:51 ` [PATCH 2/4] KVM: nVMX: Do not put exception that caused vmexit to IDT_VECTORING_INFO Gleb Natapov
2013-09-25  9:51 ` [PATCH 3/4] KVM: nVMX: Check all exceptions for intercept during delivery to L2 Gleb Natapov
2013-09-25 10:38   ` Paolo Bonzini [this message]
2013-09-25 11:00     ` Gleb Natapov
2013-09-25 11:25       ` Paolo Bonzini
2013-09-25 11:52         ` Gleb Natapov
2013-09-25 14:00   ` Paolo Bonzini
2013-09-25 14:19     ` Gleb Natapov
2013-09-25 14:22       ` Paolo Bonzini
2013-09-25 16:31         ` Gleb Natapov
2013-09-25  9:51 ` [PATCH 4/4] KVM: nVMX: Do not generate #DF if #PF happens during exception delivery into L2 Gleb Natapov
2013-09-25 11:24   ` Paolo Bonzini
2013-09-25 11:51     ` Gleb Natapov
2013-09-25 12:08       ` Paolo Bonzini
2013-09-25 12:21         ` Gleb Natapov
2013-09-25 13:26           ` Paolo Bonzini
2013-09-25 13:36             ` Gleb Natapov
2013-09-25 13:53               ` Paolo Bonzini
2013-09-26 15:10 ` [PATCH 0/4] Fix shadow-on-shadow nested VMX Paolo Bonzini

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=5242BD1C.1020903@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).