On Thu, May 27, 2010 at 02:53:18PM -0400, Jan Kiszka wrote: > Based on the KVM code (which is known to work perfectly :) ), I think > you are right: SVM apparently clears the valid bit in EVENTINJ during > VMRUN once it starts processing the injection, not after it as it's the > case in current QEMU. But better ask the experts: Jörg, Gleb?
SVM always clears the vmcb.eventinj on vmrun because every exception is injected right after vmrun finished and cpu is in guest mode. It can happen (for example if taking the exception causes a page fault) that the vmcb.eventinj field is copied to vmcb.exit_int_info. Also note that at this point there is a difference between hardware svm and the nested-svm implementation in kvm. The hardware always takes the exception first before checking for any other intercept condition. This basically means that exit_int_info is only set when the injected event could not be delivered due to other conditions in the guest (page fault, nested page-fault, ...). In nested-svm you can get a valid exit_int_info when an interrupt or nmi is pending too. In the software implementation these intercepts are taken before the event is delivered and you find the event in vmcb.exit_int_info. This is not forbidden in the svm architecture and I have not found a hypervisor that has a problem with this different behavior. I have a patch here which changes this in nested-svm, but it introduces more problems than it fixes. Joerg