From 8619f7c836156b5704c32aca7b7808ef344989c3 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Wed, 3 Mar 2021 13:05:34 +0200 Subject: [PATCH 2/2] KVM: x86: Guest debug: don't inject interrupts while single stepping Signed-off-by: Maxim Levitsky --- arch/x86/kvm/x86.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b140fce829286..ab3a598520ff4 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8542,6 +8542,12 @@ static void inject_pending_event(struct kvm_vcpu *vcpu, bool *req_immediate_exit goto busy; } + /* + * Don't inject interrupts while single stepping to make guest debug easier + */ + if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) + return; + /* * Finally, inject interrupt events. If an event cannot be injected * due to architectural conditions (e.g. IF=0) a window-open exit -- 2.26.2