linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <wanpeng.li@linux.intel.com>,
	Jan Kiszka <jan.kiszka@siemens.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Gleb Natapov <gleb@kernel.org>, Bandan Das <bsd@redhat.com>,
	Zhang Yang <yang.z.zhang@intel.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01
Date: Mon, 04 Aug 2014 14:51:29 +0200	[thread overview]
Message-ID: <53DF81D1.1060701@redhat.com> (raw)
In-Reply-To: <1406880727-60001-1-git-send-email-wanpeng.li@linux.intel.com>

Il 01/08/2014 10:12, Wanpeng Li ha scritto:
> External interrupt will cause L1 vmexit w/ reason external interrupt when L2 is 
> running. Then L1 will pick up the interrupt through vmcs12 if L1 set the ack 
> interrupt bit. Commit 77b0f5d (KVM: nVMX: Ack and write vector info to intr_info
> if L1 asks us to) get intr that belongs to L1 before load vmcs01 which is wrong, 
> especially this lead to the obvious L1 ack APICv behavior weired since APICv 
> is for L1 instead of L2. This patch fix it by ack intr after load vmcs01.
> 
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
>  arch/x86/kvm/vmx.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index e618f34..b8122b3 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -8754,14 +8754,6 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
>  	prepare_vmcs12(vcpu, vmcs12, exit_reason, exit_intr_info,
>  		       exit_qualification);
>  
> -	if ((exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
> -	    && nested_exit_intr_ack_set(vcpu)) {
> -		int irq = kvm_cpu_get_interrupt(vcpu);
> -		WARN_ON(irq < 0);
> -		vmcs12->vm_exit_intr_info = irq |
> -			INTR_INFO_VALID_MASK | INTR_TYPE_EXT_INTR;
> -	}
> -
>  	trace_kvm_nested_vmexit_inject(vmcs12->vm_exit_reason,
>  				       vmcs12->exit_qualification,
>  				       vmcs12->idt_vectoring_info_field,
> @@ -8771,6 +8763,14 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
>  
>  	vmx_load_vmcs01(vcpu);
>  
> +	if ((exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
> +	    && nested_exit_intr_ack_set(vcpu)) {
> +		int irq = kvm_cpu_get_interrupt(vcpu);
> +		WARN_ON(irq < 0);
> +		vmcs12->vm_exit_intr_info = irq |
> +			INTR_INFO_VALID_MASK | INTR_TYPE_EXT_INTR;
> +	}
> +
>  	vm_entry_controls_init(vmx, vmcs_read32(VM_ENTRY_CONTROLS));
>  	vm_exit_controls_init(vmx, vmcs_read32(VM_EXIT_CONTROLS));
>  	vmx_segment_cache_clear(vmx);
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>


  parent reply	other threads:[~2014-08-04 12:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  8:12 [PATCH 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01 Wanpeng Li
2014-08-01  8:12 ` [PATCH 2/2] KVM: nVMX: fix acknowledge interrupt on exit when APICv is in use Wanpeng Li
2014-08-04  2:03   ` Liu, RongrongX
2014-08-04 12:51   ` Paolo Bonzini
2014-08-04  2:01 ` [PATCH 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01 Liu, RongrongX
2014-08-04 12:51 ` Paolo Bonzini [this message]
2014-08-04 19:56 ` Davidlohr Bueso
2014-08-05  4:48   ` Wanpeng Li

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=53DF81D1.1060701@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bsd@redhat.com \
    --cc=gleb@kernel.org \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=wanpeng.li@linux.intel.com \
    --cc=yang.z.zhang@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;
as well as URLs for NNTP newsgroup(s).