> On May 18, 2020, at 11:38 PM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > On 18/05/20 23:36, Felipe Franciosi wrote: >> exception_type(ctxt->exception.vector) == EXCPT_TRAP) { >> kvm_rip_write(vcpu, ctxt->eip); >> - if (r && ctxt->tf) >> + if ((r && ctxt->tf) || (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)) >> r = kvm_vcpu_do_singlestep(vcpu); > > Almost: > > if (r && (ctxt->tf || (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)) > > This is because if r == 0 you have to exit to userspace with KVM_EXIT_MMIO > and KVM_EXIT_IO before completing execution of the instruction. Once > this is done, you'll get here again and you'll be able to go through > kvm_vcpu_do_singlestep. AHH yeah. I tested *only* with SINGLESTEP enabled and I didn't do any MMIO/PIO, so I didn't even realise it. Thanks. Sending v2. F. > > Thanks, > > Paolo >