On Tue, May 05, 2009 at 11:25:13AM +0200, Jan Kiszka wrote: > Gleb Natapov wrote: > > On Tue, May 05, 2009 at 10:45:20AM +0200, Jan Kiszka wrote: > >>> @@ -2331,8 +2358,16 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu) > >>> { > >>> struct vcpu_svm *svm = to_svm(vcpu); > >>> > >>> - if (svm->vmcb->control.int_state & SVM_INTERRUPT_SHADOW_MASK) > >>> - enable_irq_window(vcpu); > >>> + if ((svm->vcpu.arch.hflags & (HF_NMI_MASK | HF_IRET_MASK)) > >>> + == HF_NMI_MASK) > >>> + return; /* IRET will cause a vm exit */ > >>> + > >>> + /* Something prevents NMI from been injected. Single step over > >>> + possible problem (IRET or exception injection or interrupt > >>> + shadow) */ > >>> + vcpu->arch.singlestep = true; > >>> + svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF); > >> Can you single-step like this out of an IRQ handler? I mean, IRET will > >> restore the flags from the stack, and those settings should be > >> overwritten. Or am I missing something? > >> > > It seems to be working :) Shouldn't CPU checks single step before > > executing IRET and thus using old flags value? It is interesting to > > check what rflag value is immediately after IRET. > > Hmm, guess I have to re-read some manuals. But regarding > rflags-after-iret, I think it should be cleared due to that restoring > from the stack. > Just re-tested this once more. DB is intercepted after IRET and TF/RF is cleared already. -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html