VirtualBox

Changeset 45655 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Apr 20, 2013 2:27:02 PM (12 years ago)
Author:
vboxsync
Message:

VMMR0/HM: Profiling longjmp round trips are less useful, adjusted STAM counters to reflect true time spent on VMXR0RunGuestCode.

  • Removed excessive inlining in HMVMXR0.
  • Added exit-to-ring3 stat to HWVMXR0.
Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r45653 r45655  
    25552555 * @param uIntrState    The interruptibility-state to set.
    25562556 */
    2557 DECLINLINE(int) hmR0VmxLoadGuestIntrState(PVMCPU pVCpu, uint32_t uIntrState)
     2557static int hmR0VmxLoadGuestIntrState(PVMCPU pVCpu, uint32_t uIntrState)
    25582558{
    25592559    AssertMsg(!(uIntrState & 0xfffffff0), ("%#x\n", uIntrState));   /* Bits 31:4 MBZ. */
     
    25762576 * @remarks No-long-jump zone!!!
    25772577 */
    2578 DECLINLINE(int) hmR0VmxLoadGuestRip(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     2578static int hmR0VmxLoadGuestRip(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    25792579{
    25802580    int rc = VINF_SUCCESS;
     
    26012601 * @remarks No-long-jump zone!!!
    26022602 */
    2603 DECLINLINE(int) hmR0VmxLoadGuestRsp(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     2603static int hmR0VmxLoadGuestRsp(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    26042604{
    26052605    int rc = VINF_SUCCESS;
     
    26252625 * @remarks No-long-jump zone!!!
    26262626 */
    2627 DECLINLINE(int) hmR0VmxLoadGuestRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     2627static int hmR0VmxLoadGuestRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    26282628{
    26292629    int rc = VINF_SUCCESS;
     
    26712671 * @remarks No-long-jump zone!!!
    26722672 */
    2673 DECLINLINE(int) hmR0VmxLoadGuestRipRspRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     2673static int hmR0VmxLoadGuestRipRspRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    26742674{
    26752675    int rc = hmR0VmxLoadGuestRip(pVCpu, pMixedCtx);
     
    26932693 * @remarks No-long-jump zone!!!
    26942694 */
    2695 DECLINLINE(int) hmR0VmxLoadGuestControlRegs(PVMCPU pVCpu, PCPUMCTX pCtx)
     2695static int hmR0VmxLoadGuestControlRegs(PVMCPU pVCpu, PCPUMCTX pCtx)
    26962696{
    26972697    int rc  = VINF_SUCCESS;
     
    30423042 * @remarks No-long-jump zone!!!
    30433043 */
    3044 DECLINLINE(int) hmR0VmxLoadGuestDebugRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     3044static int hmR0VmxLoadGuestDebugRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    30453045{
    30463046    if (!(pVCpu->hm.s.fContextUseFlags & HM_CHANGED_GUEST_DEBUG))
     
    33083308 * @remarks No-long-jump zone!!!
    33093309 */
    3310 DECLINLINE(int) hmR0VmxWriteSegmentReg(PVMCPU pVCpu, uint32_t idxSel, uint32_t idxLimit, uint32_t idxBase,
     3310static int hmR0VmxWriteSegmentReg(PVMCPU pVCpu, uint32_t idxSel, uint32_t idxLimit, uint32_t idxBase,
    33113311                                       uint32_t idxAccess, PCPUMSELREG pSelReg, PCPUMCTX pCtx)
    33123312{
     
    33603360 * @remarks No-long-jump zone!!!
    33613361 */
    3362 DECLINLINE(int) hmR0VmxLoadGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     3362static int hmR0VmxLoadGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    33633363{
    33643364    int rc  = VERR_INTERNAL_ERROR_5;
     
    35713571 * @remarks No-long-jump zone!!!
    35723572 */
    3573 DECLINLINE(int) hmR0VmxLoadGuestMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     3573static int hmR0VmxLoadGuestMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    35743574{
    35753575    AssertPtr(pVCpu);
     
    36923692 * @remarks No-long-jump zone!!!
    36933693 */
    3694 DECLINLINE(int) hmR0VmxLoadGuestActivityState(PVMCPU pVCpu, PCPUMCTX pCtx)
     3694static int hmR0VmxLoadGuestActivityState(PVMCPU pVCpu, PCPUMCTX pCtx)
    36953695{
    36963696    /** @todo See if we can make use of other states, e.g.
     
    37183718 * @remarks No-long-jump zone!!!
    37193719 */
    3720 DECLINLINE(int) hmR0VmxSetupVMRunHandler(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     3720static int hmR0VmxSetupVMRunHandler(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    37213721{
    37223722    if (CPUMIsGuestInLongModeEx(pMixedCtx))
     
    47854785 * @remarks No-long-jump zone!!!
    47864786 */
    4787 DECLINLINE(int) hmR0VmxSaveGuestCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     4787static int hmR0VmxSaveGuestCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    47884788{
    47894789    int rc = VINF_SUCCESS;
     
    48144814 * @remarks No-long-jump zone!!!
    48154815 */
    4816 DECLINLINE(int) hmR0VmxSaveGuestCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     4816static int hmR0VmxSaveGuestCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    48174817{
    48184818    int rc = VINF_SUCCESS;
     
    48434843 * @remarks No-long-jump zone!!!
    48444844 */
    4845 DECLINLINE(int) hmR0VmxSaveGuestRip(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    4846 {
    4847     if (pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_RIP)
    4848         return VINF_SUCCESS;
    4849 
    4850     RTGCUINTREG uVal = 0;
    4851     int rc = VMXReadVmcsGstN(VMX_VMCS_GUEST_RIP, &uVal);
    4852     AssertRCReturn(rc, rc);
    4853     pMixedCtx->rip = uVal;
    4854     pVCpu->hm.s.vmx.fUpdatedGuestState |= HMVMX_UPDATED_GUEST_RIP;
     4845static int hmR0VmxSaveGuestRip(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     4846{
     4847    int rc = VINF_SUCCESS;
     4848    if (!(pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_RIP))
     4849    {
     4850        RTGCUINTREG uVal = 0;
     4851        rc = VMXReadVmcsGstN(VMX_VMCS_GUEST_RIP, &uVal);
     4852        AssertRCReturn(rc, rc);
     4853        pMixedCtx->rip = uVal;
     4854        pVCpu->hm.s.vmx.fUpdatedGuestState |= HMVMX_UPDATED_GUEST_RIP;
     4855    }
    48554856    return rc;
    48564857}
     
    48684869 * @remarks No-long-jump zone!!!
    48694870 */
    4870 DECLINLINE(int) hmR0VmxSaveGuestRsp(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    4871 {
    4872     if (pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_RSP)
    4873         return VINF_SUCCESS;
    4874 
    4875     RTGCUINTREG uVal = 0;
    4876     int rc = VMXReadVmcsGstN(VMX_VMCS_GUEST_RSP, &uVal);
    4877     AssertRCReturn(rc, rc);
    4878     pMixedCtx->rsp = uVal;
    4879     pVCpu->hm.s.vmx.fUpdatedGuestState |= HMVMX_UPDATED_GUEST_RSP;
     4871static int hmR0VmxSaveGuestRsp(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     4872{
     4873    int rc = VINF_SUCCESS;
     4874    if (!(pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_RSP))
     4875    {
     4876        RTGCUINTREG uVal = 0;
     4877        rc = VMXReadVmcsGstN(VMX_VMCS_GUEST_RSP, &uVal);
     4878        AssertRCReturn(rc, rc);
     4879        pMixedCtx->rsp = uVal;
     4880        pVCpu->hm.s.vmx.fUpdatedGuestState |= HMVMX_UPDATED_GUEST_RSP;
     4881    }
    48804882    return rc;
    48814883}
     
    48934895 * @remarks No-long-jump zone!!!
    48944896 */
    4895 DECLINLINE(int) hmR0VmxSaveGuestRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    4896 {
    4897     if (pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_RFLAGS)
    4898         return VINF_SUCCESS;
    4899 
    4900     RTGCUINTREG uVal = 0;
    4901     int rc = VMXReadVmcsGstN(VMX_VMCS_GUEST_RFLAGS, &uVal);
    4902     AssertRCReturn(rc, rc);
    4903     pMixedCtx->rflags.u64 = uVal;
    4904 
    4905     /* Undo our real-on-v86-mode changes to eflags if necessary. */
    4906     if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
    4907     {
    4908         PVM pVM = pVCpu->CTX_SUFF(pVM);
    4909         Assert(pVM->hm.s.vmx.pRealModeTSS);
    4910         Log(("Saving real-mode RFLAGS VT-x view=%#RX64\n", pMixedCtx->rflags.u64));
    4911         pMixedCtx->eflags.Bits.u1VM   = 0;
    4912         pMixedCtx->eflags.Bits.u2IOPL = pVCpu->hm.s.vmx.RealMode.eflags.Bits.u2IOPL;
    4913     }
    4914 
    4915     pVCpu->hm.s.vmx.fUpdatedGuestState |= HMVMX_UPDATED_GUEST_RFLAGS;
     4897static int hmR0VmxSaveGuestRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     4898{
     4899    int rc = VINF_SUCCESS;
     4900    if (!(pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_RFLAGS))
     4901    {
     4902        RTGCUINTREG uVal = 0;
     4903        rc = VMXReadVmcsGstN(VMX_VMCS_GUEST_RFLAGS, &uVal);
     4904        AssertRCReturn(rc, rc);
     4905        pMixedCtx->rflags.u64 = uVal;
     4906
     4907        /* Undo our real-on-v86-mode changes to eflags if necessary. */
     4908        if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
     4909        {
     4910            PVM pVM = pVCpu->CTX_SUFF(pVM);
     4911            Assert(pVM->hm.s.vmx.pRealModeTSS);
     4912            Log(("Saving real-mode RFLAGS VT-x view=%#RX64\n", pMixedCtx->rflags.u64));
     4913            pMixedCtx->eflags.Bits.u1VM   = 0;
     4914            pMixedCtx->eflags.Bits.u2IOPL = pVCpu->hm.s.vmx.RealMode.eflags.Bits.u2IOPL;
     4915        }
     4916
     4917        pVCpu->hm.s.vmx.fUpdatedGuestState |= HMVMX_UPDATED_GUEST_RFLAGS;
     4918    }
    49164919    return rc;
    49174920}
     
    49224925 * guest-CPU context.
    49234926 */
    4924 static int hmR0VmxSaveGuestRipRspRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     4927DECLINLINE(int) hmR0VmxSaveGuestRipRspRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    49254928{
    49264929    int rc = hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
     
    49424945 * @remarks No-long-jump zone!!!
    49434946 */
    4944 DECLINLINE(void) hmR0VmxSaveGuestIntrState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     4947static void hmR0VmxSaveGuestIntrState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    49454948{
    49464949    uint32_t uIntrState = 0;
     
    49744977 * @remarks No-long-jump zone!!!
    49754978 */
    4976 DECLINLINE(int) hmR0VmxSaveGuestActivityState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     4979static int hmR0VmxSaveGuestActivityState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    49774980{
    49784981    /* Nothing to do for now until we make use of different guest-CPU activity state. Just update the flag. */
     
    49944997 * @remarks No-long-jump zone!!!
    49954998 */
    4996 DECLINLINE(int) hmR0VmxSaveGuestSysenterMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     4999static int hmR0VmxSaveGuestSysenterMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    49975000{
    49985001    int rc = VINF_SUCCESS;
     
    50345037 * @remarks No-long-jump zone!!!
    50355038 */
    5036 DECLINLINE(int) hmR0VmxSaveGuestFSBaseMsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     5039static int hmR0VmxSaveGuestFSBaseMsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    50375040{
    50385041    RTGCUINTREG uVal = 0;
     
    50605063 * @remarks No-long-jump zone!!!
    50615064 */
    5062 DECLINLINE(int) hmR0VmxSaveGuestGSBaseMsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     5065static int hmR0VmxSaveGuestGSBaseMsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    50635066{
    50645067    RTGCUINTREG uVal = 0;
     
    51305133 * @remarks No-long-jump zone!!!
    51315134 */
    5132 DECLINLINE(int) hmR0VmxSaveGuestControlRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     5135static int hmR0VmxSaveGuestControlRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    51335136{
    51345137    RTGCUINTREG uVal    = 0;
     
    53375340 * @remarks No-long-jump zone!!!
    53385341 */
    5339 DECLINLINE(int) hmR0VmxSaveGuestDebugRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     5342static int hmR0VmxSaveGuestDebugRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    53405343{
    53415344    int rc = VINF_SUCCESS;
     
    53635366 * @remarks No-long-jump zone!!!
    53645367 */
    5365 DECLINLINE(int) hmR0VmxSaveGuestApicState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     5368static int hmR0VmxSaveGuestApicState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    53665369{
    53675370    /* Updating TPR is already done in hmR0VmxPostRunGuest(). Just update the flag. */
     
    57165719    }
    57175720
     5721    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit2, x);
     5722    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitIO, y1);
     5723    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitMovCRx, y2);
     5724    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitXcptNmi, y3);
    57185725    STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchLongJmpToR3);
    57195726}
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r45653 r45655  
    50535053    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit1, x);
    50545054    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatEntry, x);
     5055    STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchExitToR3);
    50555056    Log2(("X"));
    50565057    return VBOXSTRICTRC_TODO(rc);
     
    51345135    AssertRC(rc);
    51355136
     5137    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit2, x);
     5138    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitIO, y1);
     5139    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitMovCRx, y2);
     5140    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitXcptNmi, y3);
    51365141    return VINF_SUCCESS;
    51375142}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette