2017-06-21 18:55+0200, Radim Krčmář: > 2017-06-21 15:37+0200, Ladi Prosek: > > kvm_skip_emulated_instruction handles the singlestep debug exception > > which is something we almost always want. This commit (specifically > > the change in rdmsr_interception) makes the debug.flat KVM unit test > > pass on AMD. > > kvm_skip_emulated_instruction() also has a return value, which says > whether the debug exception was requested by the userspace or by the > guest (userspace has priority). > > This patch fixes the guest debugging, but userspace still won't receive > its events. I think it would be better to fix both at once, > > > Signed-off-by: Ladi Prosek <lprosek@xxxxxxxxxx> > > --- > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > > @@ -2278,7 +2278,7 @@ static int io_interception(struct vcpu_svm *svm) > > port = io_info >> 16; > > size = (io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT; > > svm->next_rip = svm->vmcb->control.exit_info_2; > > - skip_emulated_instruction(&svm->vcpu); > > + kvm_skip_emulated_instruction(&svm->vcpu); > > > > return in ? kvm_fast_pio_in(vcpu, size, port) > > : kvm_fast_pio_out(vcpu, size, port); > > i.e. > ret = kvm_skip_emulated_instruction(&svm->vcpu); > > return ret && (...); Nope, the ret has to be checked afterwards ... better look at handle_io() in vmx.c. :)