On Monday 13 September 2010 01:21:29 Avi Kivity wrote: > On 09/12/2010 07:05 PM, Nadav Har'El wrote: > >> I don't think so. We write this field as part of guest entry (that is, > >> after the decision re which vmcs to use, yes?), so guest entry will > >> always follow writing this field. Since guest entry clears the field, > >> reading it after an exit will necessarily return 0. > > > > Well, you obviously know the KVM code much better than I do, but from > > what I saw, I thought (maybe I misunderstood) that in normal > > (non-nested) KVM, this field only gets written on injection, not on > > every entry, so the code relies on the fact that the processor turns off > > the "valid" bit during exit, to avoid the same event being injected when > > the same field value is used for another entry. > > Correct. > > > I can only find code which resets this field in vmx_vcpu_reset(), > > but that doesn't get called on every entry, right? Or am I missing > > something? > > prepare_vmcs12() is called in response for a 2->1 vmexit which is first > trapped by 0, yes? Because it's called immediately after a vmexit, > VM_ENTRY_INTR_INFO_FIELD is guaranteed to have been cleared by the > processor. > > There are two cases where VM_ENTRY_INTR_INFO_FIELD can potentially not > be cleared by hardware: > > 1. if we call prepare_vmcs12() between injection and entry. This cannot > happen AFAICT. > 2. if the vmexit was really a failed 1->2 vmentry, and if the processor > doesn't clear VM_ENTRY_INTR_INFO_FIELD in response to vm entry failures > (need to check scripture) > > If neither of these are valid, the code can be removed. If only the > second, we might make it conditional. > > >> What can happen is that the contents of the field is transferred to the > >> IDT_VECTORING_INFO field or VM_EXIT_INTR_INFO field. > >> > >> (question: on a failed vmentry, is this field cleared?) > > > > I don't know the answer :-) > > Sheng? According to SDM 23.7 "VM-ENTRY FAILURES DURING OR AFTER LOADING GUEST STATE": Although this process resembles that of a VM exit, many steps taken during a VM exit do not occur for these VM-entry failures: • Most VM-exit information fields are not updated (see step 1 above). • The valid bit in the VM-entry interruption-information field is *not* cleared. • The guest-state area is not modified. • No MSRs are saved into the VM-exit MSR-store area. So VM entry failure would result in _keep_ valid bit of VM_ENTRY_INTR_INFO_FIELD. -- regards Yang, Sheng -- 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