Changeset 61648 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jun 10, 2016 10:14:16 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 107998
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r61605 r61648 2269 2269 /* If we're emulating an instruction, we shouldn't have any TRPM traps pending 2270 2270 and if we're injecting an event we should have a TRPM trap pending. */ 2271 AssertMsg(rcExit != VINF_EM_RAW_INJECT_TRPM_EVENT || TRPMHasTrap(pVCpu), ("rcExit=%Rrc\n", rcExit));2272 AssertMsg(rcExit != VINF_EM_RAW_EMULATE_INSTR || !TRPMHasTrap(pVCpu), ("rcExit=%Rrc\n", rcExit));2271 AssertMsg(rcExit != VINF_EM_RAW_INJECT_TRPM_EVENT || TRPMHasTrap(pVCpu), ("rcExit=%Rrc\n", rcExit)); 2272 AssertMsg(rcExit != VINF_EM_RAW_EMULATE_INSTR || !TRPMHasTrap(pVCpu), ("rcExit=%Rrc\n", rcExit)); 2273 2273 2274 2274 /* Sync. the necessary state for going back to ring-3. */ … … 2366 2366 Log4(("hmR0SvmSetPendingEvent: u=%#RX64 u8Vector=%#x Type=%#x ErrorCodeValid=%RTbool ErrorCode=%#RX32\n", pEvent->u, 2367 2367 pEvent->n.u8Vector, (uint8_t)pEvent->n.u3Type, !!pEvent->n.u1ErrorCodeValid, pEvent->n.u32ErrorCode)); 2368 2369 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingReflect);2370 2368 } 2371 2369 … … 2461 2459 2462 2460 hmR0SvmSetPendingEvent(pVCpu, &Event, GCPtrFaultAddress); 2463 STAM_COUNTER_DEC(&pVCpu->hm.s.StatInjectPendingReflect);2464 2461 } 2465 2462 … … 4198 4195 4199 4196 Assert(pVmcb->ctrl.ExitIntInfo.n.u3Type != SVM_EVENT_SOFTWARE_INT); 4197 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingReflect); 4200 4198 hmR0SvmSetPendingEvent(pVCpu, &pVmcb->ctrl.ExitIntInfo, 0 /* GCPtrFaultAddress */); 4201 4199 … … 4208 4206 case SVMREFLECTXCPT_DF: 4209 4207 { 4208 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingReflect); 4210 4209 hmR0SvmSetPendingXcptDF(pVCpu); 4211 4210 rc = VINF_HM_DOUBLE_FAULT; … … 5108 5107 if ((u32ErrCode & (X86_TRAP_PF_RSVD | X86_TRAP_PF_P)) == (X86_TRAP_PF_RSVD | X86_TRAP_PF_P)) 5109 5108 { 5109 /* If event delivery causes an MMIO #NPF, go back to instruction emulation as 5110 otherwise injecting the original pending event would most likely cause the same MMIO #NPF. */ 5111 if (RT_UNLIKELY(pVCpu->hm.s.Event.fPending)) 5112 return VERR_EM_INTERPRETER; 5113 5110 5114 VBOXSTRICTRC rc2 = PGMR0Trap0eHandlerNPMisconfig(pVM, pVCpu, enmNestedPagingMode, CPUMCTX2CORE(pCtx), GCPhysFaultAddr, 5111 5115 u32ErrCode); … … 5189 5193 5190 5194 /* Check if this task-switch occurred while delivering an event through the guest IDT. */ 5191 PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 5192 if ( !(pVmcb->ctrl.u64ExitInfo2 & (SVM_EXIT2_TASK_SWITCH_IRET | SVM_EXIT2_TASK_SWITCH_JMP)) 5193 && pVCpu->hm.s.Event.fPending) /** Can happen with exceptions/NMI. See @bugref{8411}.*/ 5195 if (pVCpu->hm.s.Event.fPending) /* Can happen with exceptions/NMI. See @bugref{8411}. */ 5194 5196 { 5195 5197 /* … … 5416 5418 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 5417 5419 5418 HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(); 5420 /* Paranoia; Ensure we cannot be called as a result of event delivery. */ 5421 PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 5422 Assert(!pVmcb->ctrl.ExitIntInfo.n.u1Valid); 5419 5423 5420 5424 /* We're playing with the host CPU state here, make sure we don't preempt or longjmp. */ … … 5468 5472 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 5469 5473 5470 HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(); 5474 /* Paranoia; Ensure we cannot be called as a result of event delivery. */ 5475 PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 5476 Assert(!pVmcb->ctrl.ExitIntInfo.n.u1Valid); 5471 5477 5472 5478 int rc = VERR_SVM_UNEXPECTED_XCPT_EXIT; … … 5509 5515 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 5510 5516 5511 HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(); 5517 /* Paranoia; Ensure we cannot be called as a result of event delivery. */ 5518 PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 5519 Assert(!pVmcb->ctrl.ExitIntInfo.n.u1Valid); 5512 5520 5513 5521 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestMF); … … 5544 5552 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 5545 5553 5554 /* If this #DB is the result of delivering an event, go back to the interpreter. */ 5546 5555 HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(); 5556 if (RT_UNLIKELY(pVCpu->hm.s.Event.fPending)) 5557 { 5558 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingInterpret); 5559 return VERR_EM_INTERPRETER; 5560 } 5547 5561 5548 5562 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestDB); -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r61627 r61648 5659 5659 pVCpu->hm.s.Event.cbInstr = cbInstr; 5660 5660 pVCpu->hm.s.Event.GCPtrFaultAddress = GCPtrFaultAddress; 5661 5662 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingReflect);5663 5661 } 5664 5662 … … 5819 5817 5820 5818 /* If uExitVector is #PF, CR2 value will be updated from the VMCS if it's a guest #PF. See hmR0VmxExitXcptPF(). */ 5819 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingReflect); 5821 5820 hmR0VmxSetPendingEvent(pVCpu, VMX_ENTRY_INT_INFO_FROM_EXIT_IDT_INFO(pVmxTransient->uIdtVectoringInfo), 5822 5821 0 /* cbInstr */, u32ErrCode, pMixedCtx->cr2); … … 5830 5829 case VMXREFLECTXCPT_DF: 5831 5830 { 5831 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingReflect); 5832 5832 hmR0VmxSetPendingXcptDF(pVCpu, pMixedCtx); 5833 5833 rcStrict = VINF_HM_DOUBLE_FAULT; … … 6913 6913 6914 6914 hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, cbInstr, uErrCode, GCPtrFaultAddress); 6915 STAM_COUNTER_DEC(&pVCpu->hm.s.StatInjectPendingReflect);6916 6915 } 6917 6916 … … 11168 11167 case VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT: 11169 11168 { 11169 /* 11170 * If there's any exception caused as a result of event injection, go back to 11171 * the interpreter. The page-fault case is complicated and we manually handle 11172 * any currently pending event in hmR0VmxExitXcptPF. Nested #ACs are already 11173 * handled in hmR0VmxCheckExitDueToEventDelivery. 11174 */ 11175 if (!pVCpu->hm.s.Event.fPending) 11176 { /* likely */ } 11177 else if ( uVector != X86_XCPT_PF 11178 && uVector != X86_XCPT_AC) 11179 { 11180 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingInterpret); 11181 rc = VERR_EM_INTERPRETER; 11182 break; 11183 } 11184 11170 11185 switch (uVector) 11171 11186 { … … 12520 12535 HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(); 12521 12536 12537 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitApicAccess); 12538 12522 12539 /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */ 12523 12540 VBOXSTRICTRC rcStrict1 = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient); 12524 12541 if (RT_LIKELY(rcStrict1 == VINF_SUCCESS)) 12525 { /* likely */ } 12542 { 12543 /* For some crazy guest, if an event delivery causes an APIC-access VM-exit, go to instruction emulation. */ 12544 if (RT_UNLIKELY(pVCpu->hm.s.Event.fPending)) 12545 { 12546 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingInterpret); 12547 return VERR_EM_INTERPRETER; 12548 } 12549 } 12526 12550 else 12527 12551 { … … 12586 12610 } 12587 12611 12588 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitApicAccess);12589 12612 if (rcStrict2 != VINF_SUCCESS) 12590 12613 STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchApicAccessToR3); … … 12693 12716 VBOXSTRICTRC rcStrict1 = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient); 12694 12717 if (RT_LIKELY(rcStrict1 == VINF_SUCCESS)) 12695 { /* likely */ } 12718 { 12719 /* If event delivery causes an EPT misconfig (MMIO), go back to instruction emulation as otherwise 12720 injecting the original pending event would most likely cause the same EPT misconfig VM-exit. */ 12721 if (RT_UNLIKELY(pVCpu->hm.s.Event.fPending)) 12722 { 12723 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectPendingInterpret); 12724 return VERR_EM_INTERPRETER; 12725 } 12726 } 12696 12727 else 12697 12728 { … … 12751 12782 VBOXSTRICTRC rcStrict1 = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient); 12752 12783 if (RT_LIKELY(rcStrict1 == VINF_SUCCESS)) 12753 { /* likely */ } 12784 { 12785 /* In the unlikely case that the EPT violation happened as a result of delivering an event, log it. */ 12786 if (RT_UNLIKELY(pVCpu->hm.s.Event.fPending)) 12787 Log4(("EPT violation with an event pending u64IntInfo=%#RX64\n", pVCpu->hm.s.Event.u64IntInfo)); 12788 } 12754 12789 else 12755 12790 { -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r61647 r61648 897 897 HM_REG_COUNTER(&pVCpu->hm.s.StatInjectInterrupt, "/HM/CPU%d/EventInject/Interrupt", "Injected an external interrupt into the guest."); 898 898 HM_REG_COUNTER(&pVCpu->hm.s.StatInjectXcpt, "/HM/CPU%d/EventInject/Trap", "Injected an exception into the guest."); 899 HM_REG_COUNTER(&pVCpu->hm.s.StatInjectPendingReflect, "/HM/CPU%d/EventInject/PendingReflect", "Reflecting an exception back to the guest."); 899 HM_REG_COUNTER(&pVCpu->hm.s.StatInjectPendingReflect, "/HM/CPU%d/EventInject/PendingReflect", "Reflecting an exception (or #DF) caused due to event injection."); 900 HM_REG_COUNTER(&pVCpu->hm.s.StatInjectPendingInterpret, "/HM/CPU%d/EventInject/PendingInterpret", "Falling to interpreter for handling exception caused due to event injection."); 900 901 901 902 HM_REG_COUNTER(&pVCpu->hm.s.StatFlushPage, "/HM/CPU%d/Flush/Page", "Invalidating a guest page on all guest CPUs."); -
trunk/src/VBox/VMM/include/HMInternal.h
r60850 r61648 929 929 STAMCOUNTER StatInjectXcpt; 930 930 STAMCOUNTER StatInjectPendingReflect; 931 STAMCOUNTER StatInjectPendingInterpret; 931 932 932 933 STAMCOUNTER StatExitAll;
Note:
See TracChangeset
for help on using the changeset viewer.