VirtualBox

Changeset 71344 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Mar 15, 2018 9:15:57 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
121295
Message:

VMM/HM: Add nested-guest exit reason stat array for SVM R0 execution.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r71108 r71344  
    10431043#undef HM_REG_COUNTER
    10441044
     1045        const char *const *papszDesc = ASMIsIntelCpu() || ASMIsViaCentaurCpu() ? &g_apszVTxExitReasons[0]
     1046                                                                               : &g_apszAmdVExitReasons[0];
     1047
     1048        /*
     1049         * Guest Exit reason stats.
     1050         */
    10451051        pVCpu->hm.s.paStatExitReason = NULL;
    1046 
    10471052        rc = MMHyperAlloc(pVM, MAX_EXITREASON_STAT * sizeof(*pVCpu->hm.s.paStatExitReason), 0 /* uAlignment */, MM_TAG_HM,
    10481053                          (void **)&pVCpu->hm.s.paStatExitReason);
    1049         AssertRC(rc);
    1050         if (RT_SUCCESS(rc))
    1051         {
    1052             const char *const *papszDesc = ASMIsIntelCpu() || ASMIsViaCentaurCpu() ?
    1053                                            &g_apszVTxExitReasons[0] : &g_apszAmdVExitReasons[0];
    1054             for (int j = 0; j < MAX_EXITREASON_STAT; j++)
     1054        AssertRCReturn(rc, rc);
     1055        for (int j = 0; j < MAX_EXITREASON_STAT; j++)
     1056        {
     1057            if (papszDesc[j])
    10551058            {
    1056                 if (papszDesc[j])
    1057                 {
    1058                     rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
    1059                                          STAMUNIT_OCCURENCES, papszDesc[j], "/HM/CPU%d/Exit/Reason/%02x", i, j);
    1060                     AssertRC(rc);
    1061                 }
     1059                rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     1060                                     STAMUNIT_OCCURENCES, papszDesc[j], "/HM/CPU%d/Exit/Reason/%02x", i, j);
     1061                AssertRCReturn(rc, rc);
    10621062            }
    1063             rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExitReasonNpf, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
    1064                                  "Nested page fault", "/HM/CPU%d/Exit/Reason/#NPF", i);
    1065             AssertRC(rc);
    1066         }
     1063        }
     1064        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExitReasonNpf, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
     1065                             "Nested page fault", "/HM/CPU%d/Exit/Reason/#NPF", i);
     1066        AssertRCReturn(rc, rc);
    10671067        pVCpu->hm.s.paStatExitReasonR0 = MMHyperR3ToR0(pVM, pVCpu->hm.s.paStatExitReason);
    10681068# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
     
    10721072# endif
    10731073
     1074#ifdef VBOX_WITH_NESTED_HWVIRT
     1075        /*
     1076         * Nested-guest Exit reason stats.
     1077         */
     1078        pVCpu->hm.s.paStatNestedExitReason = NULL;
     1079        rc = MMHyperAlloc(pVM, MAX_EXITREASON_STAT * sizeof(*pVCpu->hm.s.paStatNestedExitReason), 0 /* uAlignment */, MM_TAG_HM,
     1080                          (void **)&pVCpu->hm.s.paStatNestedExitReason);
     1081        AssertRCReturn(rc, rc);
     1082        for (int j = 0; j < MAX_EXITREASON_STAT; j++)
     1083        {
     1084            if (papszDesc[j])
     1085            {
     1086                rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatNestedExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     1087                                     STAMUNIT_OCCURENCES, papszDesc[j], "/HM/CPU%d/NestedExit/Reason/%02x", i, j);
     1088                AssertRC(rc);
     1089            }
     1090        }
     1091        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatNestedExitReasonNpf, STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     1092                             STAMUNIT_OCCURENCES, "Nested page fault", "/HM/CPU%d/NestedExit/Reason/#NPF", i);
     1093        AssertRCReturn(rc, rc);
     1094        pVCpu->hm.s.paStatNestedExitReasonR0 = MMHyperR3ToR0(pVM, pVCpu->hm.s.paStatNestedExitReason);
     1095# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
     1096        Assert(pVCpu->hm.s.paStatNestedExitReasonR0 != NIL_RTR0PTR || !HMIsEnabled(pVM));
     1097# else
     1098        Assert(pVCpu->hm.s.paStatNestedExitReasonR0 != NIL_RTR0PTR);
     1099# endif
     1100#endif
     1101
     1102        /*
     1103         * Injected events stats.
     1104         */
    10741105        rc = MMHyperAlloc(pVM, sizeof(STAMCOUNTER) * 256, 8, MM_TAG_HM, (void **)&pVCpu->hm.s.paStatInjectedIrqs);
    10751106        AssertRCReturn(rc, rc);
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