All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: nVMX: promptly process interrupts delivered while in guest mode
@ 2021-10-20 14:52 Paolo Bonzini
  2021-10-20 19:37 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2021-10-20 14:52 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: wanpengli, seanjc, stable

Since commit c300ab9f08df ("KVM: x86: Replace late check_nested_events() hack with
more precise fix") there is no longer the certainty that check_nested_events()
tries to inject an external interrupt vmexit to L1 on every call to vcpu_enter_guest.
Therefore, even in that case we need to set KVM_REQ_EVENT.  This ensures
that inject_pending_event() is called, and from there kvm_check_nested_events().

Fixes: c300ab9f08df ("KVM: x86: Replace late check_nested_events() hack with more precise fix")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/vmx/vmx.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 79d6af09dbf4..7567e1d15017 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6331,18 +6331,13 @@ static int vmx_sync_pir_to_irr(struct kvm_vcpu *vcpu)
 
 		/*
 		 * If we are running L2 and L1 has a new pending interrupt
-		 * which can be injected, we should re-evaluate
-		 * what should be done with this new L1 interrupt.
-		 * If L1 intercepts external-interrupts, we should
-		 * exit from L2 to L1. Otherwise, interrupt should be
-		 * delivered directly to L2.
+		 * which can be injected, this may cause a vmexit or it may
+		 * be injected into L2.  Either way, this interrupt will be
+		 * processed via KVM_REQ_EVENT, not RVI, because we do not use
+		 * virtual interrupt delivery to inject L1 interrupts into L2.
 		 */
-		if (is_guest_mode(vcpu) && max_irr_updated) {
-			if (nested_exit_on_intr(vcpu))
-				kvm_vcpu_exiting_guest_mode(vcpu);
-			else
-				kvm_make_request(KVM_REQ_EVENT, vcpu);
-		}
+		if (is_guest_mode(vcpu) && max_irr_updated)
+			kvm_make_request(KVM_REQ_EVENT, vcpu);
 	} else {
 		max_irr = kvm_lapic_find_highest_irr(vcpu);
 	}
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: nVMX: promptly process interrupts delivered while in guest mode
  2021-10-20 14:52 [PATCH] KVM: nVMX: promptly process interrupts delivered while in guest mode Paolo Bonzini
@ 2021-10-20 19:37 ` Sean Christopherson
  0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2021-10-20 19:37 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: linux-kernel, kvm, wanpengli, stable

On Wed, Oct 20, 2021, Paolo Bonzini wrote:
> Since commit c300ab9f08df ("KVM: x86: Replace late check_nested_events() hack with
> more precise fix") there is no longer the certainty that check_nested_events()
> tries to inject an external interrupt vmexit to L1 on every call to vcpu_enter_guest.
> Therefore, even in that case we need to set KVM_REQ_EVENT.  This ensures
> that inject_pending_event() is called, and from there kvm_check_nested_events().
> 
> Fixes: c300ab9f08df ("KVM: x86: Replace late check_nested_events() hack with more precise fix")
> Cc: stable@vger.kernel.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-20 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 14:52 [PATCH] KVM: nVMX: promptly process interrupts delivered while in guest mode Paolo Bonzini
2021-10-20 19:37 ` Sean Christopherson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.