kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "KVM: x86: Unconditionally enable irqs in guest context"
@ 2021-01-05 19:28 Nitesh Narayan Lal
  2021-01-06  0:42 ` Wanpeng Li
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Nitesh Narayan Lal @ 2021-01-05 19:28 UTC (permalink / raw)
  To: linux-kernel, kvm, seanjc, w90p710, pbonzini, vkuznets, nitesh

This reverts commit d7a08882a0a4b4e176691331ee3f492996579534.

After the introduction of the patch:

	87fa7f3e9: x86/kvm: Move context tracking where it belongs

since we have moved guest_exit_irqoff closer to the VM-Exit, explicit
enabling of irqs to process pending interrupts should not be required
within vcpu_enter_guest anymore.

Conflicts:
	arch/x86/kvm/svm.c

Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
---
 arch/x86/kvm/svm/svm.c |  9 +++++++++
 arch/x86/kvm/x86.c     | 11 -----------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index cce0143a6f80..c9b2fbb32484 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -4187,6 +4187,15 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu,
 
 static void svm_handle_exit_irqoff(struct kvm_vcpu *vcpu)
 {
+	kvm_before_interrupt(vcpu);
+	local_irq_enable();
+	/*
+	 * We must have an instruction with interrupts enabled, so
+	 * the timer interrupt isn't delayed by the interrupt shadow.
+	 */
+	asm("nop");
+	local_irq_disable();
+	kvm_after_interrupt(vcpu);
 }
 
 static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 3f7c1fc7a3ce..3e17c9ffcad8 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -9023,18 +9023,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 
 	kvm_x86_ops.handle_exit_irqoff(vcpu);
 
-	/*
-	 * Consume any pending interrupts, including the possible source of
-	 * VM-Exit on SVM and any ticks that occur between VM-Exit and now.
-	 * An instruction is required after local_irq_enable() to fully unblock
-	 * interrupts on processors that implement an interrupt shadow, the
-	 * stat.exits increment will do nicely.
-	 */
-	kvm_before_interrupt(vcpu);
-	local_irq_enable();
 	++vcpu->stat.exits;
-	local_irq_disable();
-	kvm_after_interrupt(vcpu);
 
 	if (lapic_in_kernel(vcpu)) {
 		s64 delta = vcpu->arch.apic->lapic_timer.advance_expire_delta;
-- 
2.27.0


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

end of thread, other threads:[~2021-01-19  1:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 19:28 [PATCH] Revert "KVM: x86: Unconditionally enable irqs in guest context" Nitesh Narayan Lal
2021-01-06  0:42 ` Wanpeng Li
2021-01-06  0:47 ` Sean Christopherson
2021-01-06  1:35   ` Nitesh Narayan Lal
2021-01-15  3:20   ` Wanpeng Li
2021-01-19  1:27     ` Wanpeng Li
2021-01-06 10:09 ` Vitaly Kuznetsov
2021-01-06 17:11   ` Sean Christopherson
2021-01-07  9:33     ` Vitaly Kuznetsov
2021-01-07  9:41       ` Wanpeng Li
2021-01-12 21:43       ` Nitesh Narayan Lal
2021-01-12 22:04         ` Sean Christopherson
2021-01-07 10:55     ` Xinlong Lin

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).