public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: fix task switch emulation on INTn instruction.
@ 2022-07-14 12:44 Maxim Levitsky
  2022-07-14 13:50 ` Maciej S. Szmigiero
  2022-07-14 15:32 ` Paolo Bonzini
  0 siblings, 2 replies; 8+ messages in thread
From: Maxim Levitsky @ 2022-07-14 12:44 UTC (permalink / raw)
  To: kvm
  Cc: Thomas Gleixner, Borislav Petkov, H. Peter Anvin, Paolo Bonzini,
	Vitaly Kuznetsov, Wanpeng Li, Sean Christopherson, Joerg Roedel,
	Ingo Molnar, Dave Hansen, x86, linux-kernel, Jim Mattson,
	Maciej S. Szmigiero, Maxim Levitsky

Recently KVM's SVM code switched to re-injecting software interrupt events,
if something prevented their delivery.

Task switch due to task gate in the IDT, however is an exception
to this rule, because in this case, INTn instruction causes
a task switch intercept and its emulation completes the INTn
emulation as well.

Add a missing case to task_switch_interception for that.

This fixes 32 bit kvm unit test taskswitch2.

Fixes: 7e5b5ef8dca322 ("KVM: SVM: Re-inject INTn instead of retrying the insn on "failure"")

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 arch/x86/kvm/svm/svm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 41bd7c5aa06a1e..638dd94f6e11f6 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -2399,6 +2399,7 @@ static int task_switch_interception(struct kvm_vcpu *vcpu)
 			kvm_clear_exception_queue(vcpu);
 			break;
 		case SVM_EXITINTINFO_TYPE_INTR:
+		case SVM_EXITINTINFO_TYPE_SOFT:
 			kvm_clear_interrupt_queue(vcpu);
 			break;
 		default:
-- 
2.34.3


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

end of thread, other threads:[~2022-07-15  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-14 12:44 [PATCH] KVM: SVM: fix task switch emulation on INTn instruction Maxim Levitsky
2022-07-14 13:50 ` Maciej S. Szmigiero
2022-07-14 13:57   ` Maxim Levitsky
2022-07-14 22:40     ` Maciej S. Szmigiero
2022-07-14 23:24       ` Sean Christopherson
2022-07-14 23:36         ` Jim Mattson
2022-07-15  0:00           ` Sean Christopherson
2022-07-14 15:32 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox