VirtualBox

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


Ignore:
Timestamp:
Nov 6, 2008 9:44:29 AM (16 years ago)
Author:
vboxsync
Message:

Moved more data to VMCPU.

Location:
trunk/src/VBox/VMM
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/HWACCM.cpp

    r13883 r13898  
    104104    pVM->hwaccm.s.fNestedPaging  = false;
    105105
    106     /*
    107      * Statistics.
    108      */
    109     STAM_REG(pVM, &pVM->hwaccm.s.StatEntry,    STAMTYPE_PROFILE, "/PROF/HWACCM/SwitchToGC",     STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode entry");
    110     STAM_REG(pVM, &pVM->hwaccm.s.StatExit,     STAMTYPE_PROFILE, "/PROF/HWACCM/SwitchFromGC",   STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode exit");
    111     STAM_REG(pVM, &pVM->hwaccm.s.StatInGC,     STAMTYPE_PROFILE, "/PROF/HWACCM/InGC",           STAMUNIT_TICKS_PER_CALL, "Profiling of vmlaunch");
    112 
    113     STAM_REG(pVM, &pVM->hwaccm.s.StatExitShadowNM,  STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Shadow/#NM",   STAMUNIT_OCCURENCES,    "Nr of occurances");
    114     STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestNM,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#NM",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    115     STAM_REG(pVM, &pVM->hwaccm.s.StatExitShadowPF,  STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Shadow/#PF",   STAMUNIT_OCCURENCES,    "Nr of occurances");
    116     STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestPF,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#PF",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    117     STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestUD,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#UD",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    118     STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestSS,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#SS",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    119     STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestNP,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#NP",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    120     STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestGP,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#GP",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    121     STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestMF,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#MF",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    122     STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestDE,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#DE",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    123     STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestDB,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#DB",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    124     STAM_REG(pVM, &pVM->hwaccm.s.StatExitInvpg,     STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Invlpg",      STAMUNIT_OCCURENCES,    "Nr of occurances");
    125     STAM_REG(pVM, &pVM->hwaccm.s.StatExitInvd,      STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Invd",        STAMUNIT_OCCURENCES,    "Nr of occurances");
    126     STAM_REG(pVM, &pVM->hwaccm.s.StatExitCpuid,     STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Cpuid",       STAMUNIT_OCCURENCES,    "Nr of occurances");
    127     STAM_REG(pVM, &pVM->hwaccm.s.StatExitRdtsc,     STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Rdtsc",       STAMUNIT_OCCURENCES,    "Nr of occurances");
    128     STAM_REG(pVM, &pVM->hwaccm.s.StatExitCRxWrite,  STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Write",   STAMUNIT_OCCURENCES,    "Nr of occurances");
    129     STAM_REG(pVM, &pVM->hwaccm.s.StatExitCRxRead,   STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Read",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    130     STAM_REG(pVM, &pVM->hwaccm.s.StatExitDRxWrite,  STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/DRx/Write",   STAMUNIT_OCCURENCES,    "Nr of occurances");
    131     STAM_REG(pVM, &pVM->hwaccm.s.StatExitDRxRead,   STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/DRx/Read",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    132     STAM_REG(pVM, &pVM->hwaccm.s.StatExitCLTS,      STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CLTS",        STAMUNIT_OCCURENCES,    "Nr of occurances");
    133     STAM_REG(pVM, &pVM->hwaccm.s.StatExitLMSW,      STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/LMSW",        STAMUNIT_OCCURENCES,    "Nr of occurances");
    134     STAM_REG(pVM, &pVM->hwaccm.s.StatExitIOWrite,   STAMTYPE_COUNTER, "/HWACCM/Exit/IO/Write",          STAMUNIT_OCCURENCES,    "Nr of occurances");
    135     STAM_REG(pVM, &pVM->hwaccm.s.StatExitIORead,    STAMTYPE_COUNTER, "/HWACCM/Exit/IO/Read",           STAMUNIT_OCCURENCES,    "Nr of occurances");
    136     STAM_REG(pVM, &pVM->hwaccm.s.StatExitIOStringWrite,   STAMTYPE_COUNTER, "/HWACCM/Exit/IO/WriteString",          STAMUNIT_OCCURENCES,    "Nr of occurances");
    137     STAM_REG(pVM, &pVM->hwaccm.s.StatExitIOStringRead,    STAMTYPE_COUNTER, "/HWACCM/Exit/IO/ReadString",           STAMUNIT_OCCURENCES,    "Nr of occurances");
    138     STAM_REG(pVM, &pVM->hwaccm.s.StatExitIrqWindow, STAMTYPE_COUNTER, "/HWACCM/Exit/GuestIrq/Pending",  STAMUNIT_OCCURENCES,    "Nr of occurances");
    139     STAM_REG(pVM, &pVM->hwaccm.s.StatExitMaxResume, STAMTYPE_COUNTER, "/HWACCM/Exit/Safety/MaxResume",  STAMUNIT_OCCURENCES,    "Nr of occurances");
    140 
    141     STAM_REG(pVM, &pVM->hwaccm.s.StatSwitchGuestIrq,STAMTYPE_COUNTER, "/HWACCM/Switch/IrqPending",      STAMUNIT_OCCURENCES,    "Nr of occurances");
    142     STAM_REG(pVM, &pVM->hwaccm.s.StatSwitchToR3,    STAMTYPE_COUNTER, "/HWACCM/Switch/ToR3",            STAMUNIT_OCCURENCES,    "Nr of occurances");
    143 
    144     STAM_REG(pVM, &pVM->hwaccm.s.StatIntInject,     STAMTYPE_COUNTER, "/HWACCM/Irq/Inject",             STAMUNIT_OCCURENCES,    "Nr of occurances");
    145     STAM_REG(pVM, &pVM->hwaccm.s.StatIntReinject,   STAMTYPE_COUNTER, "/HWACCM/Irq/Reinject",           STAMUNIT_OCCURENCES,    "Nr of occurances");
    146     STAM_REG(pVM, &pVM->hwaccm.s.StatPendingHostIrq,STAMTYPE_COUNTER, "/HWACCM/Irq/PendingOnHost",      STAMUNIT_OCCURENCES,    "Nr of occurances");
    147 
    148     STAM_REG(pVM, &pVM->hwaccm.s.StatFlushPageManual,       STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Virt/Manual", STAMUNIT_OCCURENCES,    "Nr of occurances");
    149     STAM_REG(pVM, &pVM->hwaccm.s.StatFlushPhysPageManual,   STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Phys/Manual", STAMUNIT_OCCURENCES,    "Nr of occurances");
    150     STAM_REG(pVM, &pVM->hwaccm.s.StatFlushTLBManual,        STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Manual",  STAMUNIT_OCCURENCES,    "Nr of occurances");
    151     STAM_REG(pVM, &pVM->hwaccm.s.StatFlushTLBCRxChange,     STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/CRx",     STAMUNIT_OCCURENCES,    "Nr of occurances");
    152     STAM_REG(pVM, &pVM->hwaccm.s.StatFlushPageInvlpg,       STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Invlpg", STAMUNIT_OCCURENCES,    "Nr of occurances");
    153     STAM_REG(pVM, &pVM->hwaccm.s.StatFlushTLBWorldSwitch,   STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Switch",  STAMUNIT_OCCURENCES,    "Nr of occurances");
    154     STAM_REG(pVM, &pVM->hwaccm.s.StatNoFlushTLBWorldSwitch, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Skipped", STAMUNIT_OCCURENCES,    "Nr of occurances");
    155     STAM_REG(pVM, &pVM->hwaccm.s.StatFlushASID,             STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/ASID",    STAMUNIT_OCCURENCES,    "Nr of occurances");
    156     STAM_REG(pVM, &pVM->hwaccm.s.StatFlushTLBInvlpga,       STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/PhysInvlpg",  STAMUNIT_OCCURENCES,    "Nr of occurances");
    157 
    158     STAM_REG(pVM, &pVM->hwaccm.s.StatTSCOffset,             STAMTYPE_COUNTER, "/HWACCM/TSC/Offset",        STAMUNIT_OCCURENCES,    "Nr of occurances");
    159     STAM_REG(pVM, &pVM->hwaccm.s.StatTSCIntercept,          STAMTYPE_COUNTER, "/HWACCM/TSC/Intercept",     STAMUNIT_OCCURENCES,    "Nr of occurances");
    160 
    161     STAM_REG(pVM, &pVM->hwaccm.s.StatDRxArmed,              STAMTYPE_COUNTER, "/HWACCM/Debug/Armed",           STAMUNIT_OCCURENCES,    "Nr of occurances");
    162     STAM_REG(pVM, &pVM->hwaccm.s.StatDRxContextSwitch,      STAMTYPE_COUNTER, "/HWACCM/Debug/ContextSwitch",   STAMUNIT_OCCURENCES,    "Nr of occurances");
    163     STAM_REG(pVM, &pVM->hwaccm.s.StatDRxIOCheck,            STAMTYPE_COUNTER, "/HWACCM/Debug/IOCheck",         STAMUNIT_OCCURENCES,    "Nr of occurances");
    164 
    165     pVM->hwaccm.s.paStatExitReason = NULL;
    166 
    167 #ifdef VBOX_WITH_STATISTICS
    168     rc = MMHyperAlloc(pVM, MAX_EXITREASON_STAT*sizeof(*pVM->hwaccm.s.paStatExitReason), 0, MM_TAG_HWACCM, (void **)&pVM->hwaccm.s.paStatExitReason);
    169     AssertRC(rc);
    170     if (RT_SUCCESS(rc))
    171     {
    172         for (int i=0;i<MAX_EXITREASON_STAT;i++)
    173         {
    174             int rc = STAMR3RegisterF(pVM, &pVM->hwaccm.s.paStatExitReason[i], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, "Exit reason",
    175                                      "/HWACCM/Exit/Reason/%02x", i);
    176             AssertRC(rc);
    177         }
    178         int rc = STAMR3Register(pVM, &pVM->hwaccm.s.StatExitReasonNPF, STAMTYPE_COUNTER, STAMVISIBILITY_USED, "/HWACCM/Exit/Reason/#NPF", STAMUNIT_OCCURENCES, "Exit reason");
    179         AssertRC(rc);
    180     }
    181     pVM->hwaccm.s.paStatExitReasonR0 = MMHyperR3ToR0(pVM, pVM->hwaccm.s.paStatExitReason);
    182     Assert(pVM->hwaccm.s.paStatExitReasonR0);
    183 #endif
    184 
    185106    /* Disabled by default. */
    186107    pVM->fHWACCMEnabled = false;
     
    194115
    195116    /* VT-x VPID: disabled by default. */
    196     rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnableVPID", &pVM->hwaccm.s.fAllowVPID, false);
     117    rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnableVPID", &pVM->hwaccm.s.vmx.fAllowVPID, false);
    197118    AssertRC(rc);
    198119
     
    213134{
    214135    LogFlow(("HWACCMR3InitCPU\n"));
     136
     137    /*
     138     * Statistics.
     139     */
     140    for (unsigned i=0;i<pVM->cCPUs;i++)
     141    {
     142        PVMCPU pVCpu = &pVM->aCpus[i];
     143
     144        STAM_REG(pVM, &pVCpu->hwaccm.s.StatEntry,    STAMTYPE_PROFILE, "/PROF/HWACCM/SwitchToGC",     STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode entry");
     145        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExit,     STAMTYPE_PROFILE, "/PROF/HWACCM/SwitchFromGC",   STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode exit");
     146        STAM_REG(pVM, &pVCpu->hwaccm.s.StatInGC,     STAMTYPE_PROFILE, "/PROF/HWACCM/InGC",           STAMUNIT_TICKS_PER_CALL, "Profiling of vmlaunch");
     147
     148        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitShadowNM,  STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Shadow/#NM",   STAMUNIT_OCCURENCES,    "Nr of occurances");
     149        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestNM,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#NM",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     150        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitShadowPF,  STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Shadow/#PF",   STAMUNIT_OCCURENCES,    "Nr of occurances");
     151        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestPF,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#PF",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     152        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestUD,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#UD",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     153        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestSS,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#SS",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     154        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestNP,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#NP",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     155        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestGP,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#GP",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     156        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestMF,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#MF",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     157        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestDE,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#DE",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     158        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestDB,   STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#DB",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     159        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitInvpg,     STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Invlpg",      STAMUNIT_OCCURENCES,    "Nr of occurances");
     160        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitInvd,      STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Invd",        STAMUNIT_OCCURENCES,    "Nr of occurances");
     161        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitCpuid,     STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Cpuid",       STAMUNIT_OCCURENCES,    "Nr of occurances");
     162        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitRdtsc,     STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Rdtsc",       STAMUNIT_OCCURENCES,    "Nr of occurances");
     163        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitCRxWrite,  STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Write",   STAMUNIT_OCCURENCES,    "Nr of occurances");
     164        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitCRxRead,   STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Read",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     165        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitDRxWrite,  STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/DRx/Write",   STAMUNIT_OCCURENCES,    "Nr of occurances");
     166        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitDRxRead,   STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/DRx/Read",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     167        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitCLTS,      STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CLTS",        STAMUNIT_OCCURENCES,    "Nr of occurances");
     168        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitLMSW,      STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/LMSW",        STAMUNIT_OCCURENCES,    "Nr of occurances");
     169        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIOWrite,   STAMTYPE_COUNTER, "/HWACCM/Exit/IO/Write",          STAMUNIT_OCCURENCES,    "Nr of occurances");
     170        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIORead,    STAMTYPE_COUNTER, "/HWACCM/Exit/IO/Read",           STAMUNIT_OCCURENCES,    "Nr of occurances");
     171        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIOStringWrite,   STAMTYPE_COUNTER, "/HWACCM/Exit/IO/WriteString",          STAMUNIT_OCCURENCES,    "Nr of occurances");
     172        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIOStringRead,    STAMTYPE_COUNTER, "/HWACCM/Exit/IO/ReadString",           STAMUNIT_OCCURENCES,    "Nr of occurances");
     173        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIrqWindow, STAMTYPE_COUNTER, "/HWACCM/Exit/GuestIrq/Pending",  STAMUNIT_OCCURENCES,    "Nr of occurances");
     174        STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitMaxResume, STAMTYPE_COUNTER, "/HWACCM/Exit/Safety/MaxResume",  STAMUNIT_OCCURENCES,    "Nr of occurances");
     175
     176        STAM_REG(pVM, &pVCpu->hwaccm.s.StatSwitchGuestIrq,STAMTYPE_COUNTER, "/HWACCM/Switch/IrqPending",      STAMUNIT_OCCURENCES,    "Nr of occurances");
     177        STAM_REG(pVM, &pVCpu->hwaccm.s.StatSwitchToR3,    STAMTYPE_COUNTER, "/HWACCM/Switch/ToR3",            STAMUNIT_OCCURENCES,    "Nr of occurances");
     178
     179        STAM_REG(pVM, &pVCpu->hwaccm.s.StatIntInject,     STAMTYPE_COUNTER, "/HWACCM/Irq/Inject",             STAMUNIT_OCCURENCES,    "Nr of occurances");
     180        STAM_REG(pVM, &pVCpu->hwaccm.s.StatIntReinject,   STAMTYPE_COUNTER, "/HWACCM/Irq/Reinject",           STAMUNIT_OCCURENCES,    "Nr of occurances");
     181        STAM_REG(pVM, &pVCpu->hwaccm.s.StatPendingHostIrq,STAMTYPE_COUNTER, "/HWACCM/Irq/PendingOnHost",      STAMUNIT_OCCURENCES,    "Nr of occurances");
     182
     183        STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushPageManual,       STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Virt/Manual", STAMUNIT_OCCURENCES,    "Nr of occurances");
     184        STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushPhysPageManual,   STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Phys/Manual", STAMUNIT_OCCURENCES,    "Nr of occurances");
     185        STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushTLBManual,        STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Manual",  STAMUNIT_OCCURENCES,    "Nr of occurances");
     186        STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushTLBCRxChange,     STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/CRx",     STAMUNIT_OCCURENCES,    "Nr of occurances");
     187        STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushPageInvlpg,       STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Invlpg", STAMUNIT_OCCURENCES,    "Nr of occurances");
     188        STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushTLBWorldSwitch,   STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Switch",  STAMUNIT_OCCURENCES,    "Nr of occurances");
     189        STAM_REG(pVM, &pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Skipped", STAMUNIT_OCCURENCES,    "Nr of occurances");
     190        STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushASID,             STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/ASID",    STAMUNIT_OCCURENCES,    "Nr of occurances");
     191        STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushTLBInvlpga,       STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/PhysInvlpg",  STAMUNIT_OCCURENCES,    "Nr of occurances");
     192
     193        STAM_REG(pVM, &pVCpu->hwaccm.s.StatTSCOffset,             STAMTYPE_COUNTER, "/HWACCM/TSC/Offset",        STAMUNIT_OCCURENCES,    "Nr of occurances");
     194        STAM_REG(pVM, &pVCpu->hwaccm.s.StatTSCIntercept,          STAMTYPE_COUNTER, "/HWACCM/TSC/Intercept",     STAMUNIT_OCCURENCES,    "Nr of occurances");
     195
     196        STAM_REG(pVM, &pVCpu->hwaccm.s.StatDRxArmed,              STAMTYPE_COUNTER, "/HWACCM/Debug/Armed",           STAMUNIT_OCCURENCES,    "Nr of occurances");
     197        STAM_REG(pVM, &pVCpu->hwaccm.s.StatDRxContextSwitch,      STAMTYPE_COUNTER, "/HWACCM/Debug/ContextSwitch",   STAMUNIT_OCCURENCES,    "Nr of occurances");
     198        STAM_REG(pVM, &pVCpu->hwaccm.s.StatDRxIOCheck,            STAMTYPE_COUNTER, "/HWACCM/Debug/IOCheck",         STAMUNIT_OCCURENCES,    "Nr of occurances");
     199
     200        pVCpu->hwaccm.s.paStatExitReason = NULL;
     201
     202#ifdef VBOX_WITH_STATISTICS
     203        int rc = MMHyperAlloc(pVM, MAX_EXITREASON_STAT*sizeof(*pVCpu->hwaccm.s.paStatExitReason), 0, MM_TAG_HWACCM, (void **)&pVCpu->hwaccm.s.paStatExitReason);
     204        AssertRC(rc);
     205        if (RT_SUCCESS(rc))
     206        {
     207            for (int i=0;i<MAX_EXITREASON_STAT;i++)
     208            {
     209                rc = STAMR3RegisterF(pVM, &pVCpu->hwaccm.s.paStatExitReason[i], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, "Exit reason",
     210                                         "/HWACCM/Exit/Reason/%02x", i);
     211                AssertRC(rc);
     212            }
     213            rc = STAMR3Register(pVM, &pVCpu->hwaccm.s.StatExitReasonNPF, STAMTYPE_COUNTER, STAMVISIBILITY_USED, "/HWACCM/Exit/Reason/#NPF", STAMUNIT_OCCURENCES, "Exit reason");
     214            AssertRC(rc);
     215        }
     216        pVCpu->hwaccm.s.paStatExitReasonR0 = MMHyperR3ToR0(pVM, pVCpu->hwaccm.s.paStatExitReason);
     217        Assert(pVCpu->hwaccm.s.paStatExitReasonR0);
     218#endif
     219    }
    215220    return VINF_SUCCESS;
    216221}
     
    593598            if (    (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_VPID)
    594599                &&  !pVM->hwaccm.s.fNestedPaging)    /* VPID and EPT are mutually exclusive. */
    595                 pVM->hwaccm.s.vmx.fVPID = pVM->hwaccm.s.fAllowVPID;
     600                pVM->hwaccm.s.vmx.fVPID = pVM->hwaccm.s.vmx.fAllowVPID;
    596601#endif /* HWACCM_VTX_WITH_VPID */
    597602
     
    833838        pVM->hwaccm.s.vmx.pRealModeTSS       = 0;
    834839    }
    835 
    836     if (pVM->hwaccm.s.paStatExitReason)
    837     {
    838         MMHyperFree(pVM, pVM->hwaccm.s.paStatExitReason);
    839         pVM->hwaccm.s.paStatExitReason = NULL;
    840     }
    841840    return 0;
    842841}
     
    853852VMMR3DECL(int) HWACCMR3TermCPU(PVM pVM)
    854853{
     854    for (unsigned i=0;i<pVM->cCPUs;i++)
     855    {
     856        PVMCPU pVCpu = &pVM->aCpus[i];
     857
     858        if (pVCpu->hwaccm.s.paStatExitReason)
     859        {
     860            MMHyperFree(pVM, pVCpu->hwaccm.s.paStatExitReason);
     861            pVCpu->hwaccm.s.paStatExitReason   = NULL;
     862            pVCpu->hwaccm.s.paStatExitReasonR0 = NULL;
     863        }
     864    }
    855865    return 0;
    856866}
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r13885 r13898  
    185185    /** Set if nested paging is allowed. */
    186186    bool                        fAllowNestedPaging;
    187     /** Set if VT-x VPID is allowed. */
    188     bool                        fAllowVPID;
    189187
    190188    /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask
    191189     *  naturally. */
    192     bool                        padding[1];
     190    bool                        padding[2];
    193191
    194192    /** And mask for copying register contents. */
     
    212210        /** Set if VPID is supported. */
    213211        bool                        fVPID;
     212
     213        /** Set if VT-x VPID is allowed. */
     214        bool                        fAllowVPID;
    214215
    215216        /** Virtual address of the TSS page used for real mode emulation. */
     
    344345    /** Currenty shadow paging mode. */
    345346    PGMMODE                 enmShadowMode;
    346 
    347     /** Explicit alignment padding of StatEntry (32-bit g++ again). */
    348     int32_t                 padding2;
     347} HWACCM;
     348/** Pointer to HWACCM VM instance data. */
     349typedef HWACCM *PHWACCM;
     350
     351/**
     352 * HWACCM VMCPU Instance data.
     353 */
     354typedef struct HWACCMCPU
     355{
     356    /** Old style FPU reporting trap mask override performed (optimization) */
     357    bool                        fFPUOldStyleOverride;
     358
     359    /** Set if we don't have to flush the TLB on VM entry. */
     360    bool                        fResumeVM;
     361
     362    /** Set if we need to flush the TLB during the world switch. */
     363    bool                        fForceTLBFlush;
     364
     365    /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask
     366     *  naturally. */
     367    bool                        padding[1];
     368
     369    /** HWACCM_CHANGED_* flags. */
     370    RTUINT                      fContextUseFlags;
     371
     372    /* Id of the last cpu we were executing code on (NIL_RTCPUID for the first time) */
     373    RTCPUID                     idLastCpu;
     374
     375    /* TLB flush count */
     376    RTUINT                      cTLBFlushes;
     377
     378    /* Current ASID in use by the VM */
     379    RTUINT                      uCurrentASID;
     380
     381    struct
     382    {
     383        /** R0 memory object for the VM control structure (VMCS). */
     384        RTR0MEMOBJ                  pMemObjVMCS;
     385        /** Physical address of the VM control structure (VMCS). */
     386        RTHCPHYS                    pVMCSPhys;
     387        /** Virtual address of the VM control structure (VMCS). */
     388        R0PTRTYPE(void *)           pVMCS;
     389
     390        /** Ring 0 handlers for VT-x. */
     391        DECLR0CALLBACKMEMBER(int,  pfnStartVM,(RTHCUINT fResume, PCPUMCTX pCtx));
     392
     393        /** Current VMX_VMCS_CTRL_PROC_EXEC_CONTROLS. */
     394        uint64_t                    proc_ctls;
     395
     396        /** Current CR0 mask. */
     397        uint64_t                    cr0_mask;
     398        /** Current CR4 mask. */
     399        uint64_t                    cr4_mask;
     400
     401        /** Current EPTP. */
     402        RTHCPHYS                    GCPhysEPTP;
     403
     404        /** Real-mode emulation state. */
     405        struct
     406        {
     407            X86EFLAGS                   eflags;
     408            uint32_t                    fValid;
     409        } RealMode;
     410
     411        struct
     412        {
     413            uint64_t                u64VMCSPhys;
     414            uint32_t                ulVMCSRevision;
     415            uint32_t                ulLastInstrError;
     416            uint32_t                ulLastExitReason;
     417            uint32_t                padding;
     418        } lasterror;
     419
     420    } vmx;
     421
     422    struct
     423    {
     424        /** R0 memory object for the VM control block (VMCB). */
     425        RTR0MEMOBJ                  pMemObjVMCB;
     426        /** Physical address of the VM control block (VMCB). */
     427        RTHCPHYS                    pVMCBPhys;
     428        /** Virtual address of the VM control block (VMCB). */
     429        R0PTRTYPE(void *)           pVMCB;
     430
     431        /** Ring 0 handlers for VT-x. */
     432        DECLR0CALLBACKMEMBER(int, pfnVMRun,(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx));
     433
     434    } svm;
     435
     436#if HC_ARCH_BITS == 32
     437    uint32_t                        Alignment;
     438#endif
     439
     440    /** Event injection state. */
     441    struct
     442    {
     443        uint32_t                    fPending;
     444        uint32_t                    errCode;
     445        uint64_t                    intInfo;
     446    } Event;
    349447
    350448#ifdef VBOX_STRICT
     
    418516    R3PTRTYPE(PSTAMCOUNTER) paStatExitReason;
    419517    R0PTRTYPE(PSTAMCOUNTER) paStatExitReasonR0;
    420 } HWACCM;
    421 /** Pointer to HWACCM VM instance data. */
    422 typedef HWACCM *PHWACCM;
    423 
    424 /**
    425  * HWACCM VMCPU Instance data.
    426  */
    427 typedef struct HWACCMCPU
    428 {
    429     /** Old style FPU reporting trap mask override performed (optimization) */
    430     bool                        fFPUOldStyleOverride;
    431 
    432     /** Set if we don't have to flush the TLB on VM entry. */
    433     bool                        fResumeVM;
    434 
    435     /** Set if we need to flush the TLB during the world switch. */
    436     bool                        fForceTLBFlush;
    437 
    438     /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask
    439      *  naturally. */
    440     bool                        padding[1];
    441 
    442     /** HWACCM_CHANGED_* flags. */
    443     RTUINT                      fContextUseFlags;
    444 
    445     /* Id of the last cpu we were executing code on (NIL_RTCPUID for the first time) */
    446     RTCPUID                     idLastCpu;
    447 
    448     /* TLB flush count */
    449     RTUINT                      cTLBFlushes;
    450 
    451     /* Current ASID in use by the VM */
    452     RTUINT                      uCurrentASID;
    453 
    454     struct
    455     {
    456         /** R0 memory object for the VM control structure (VMCS). */
    457         RTR0MEMOBJ                  pMemObjVMCS;
    458         /** Physical address of the VM control structure (VMCS). */
    459         RTHCPHYS                    pVMCSPhys;
    460         /** Virtual address of the VM control structure (VMCS). */
    461         R0PTRTYPE(void *)           pVMCS;
    462 
    463         /** Ring 0 handlers for VT-x. */
    464         DECLR0CALLBACKMEMBER(int,  pfnStartVM,(RTHCUINT fResume, PCPUMCTX pCtx));
    465 
    466         /** Current VMX_VMCS_CTRL_PROC_EXEC_CONTROLS. */
    467         uint64_t                    proc_ctls;
    468 
    469         /** Current CR0 mask. */
    470         uint64_t                    cr0_mask;
    471         /** Current CR4 mask. */
    472         uint64_t                    cr4_mask;
    473 
    474         /** Current EPTP. */
    475         RTHCPHYS                    GCPhysEPTP;
    476 
    477         /** Real-mode emulation state. */
    478         struct
    479         {
    480             X86EFLAGS                   eflags;
    481             uint32_t                    fValid;
    482         } RealMode;
    483 
    484         struct
    485         {
    486             uint64_t                u64VMCSPhys;
    487             uint32_t                ulVMCSRevision;
    488             uint32_t                ulLastInstrError;
    489             uint32_t                ulLastExitReason;
    490             uint32_t                padding;
    491         } lasterror;
    492 
    493     } vmx;
    494 
    495     struct
    496     {
    497         /** R0 memory object for the VM control block (VMCB). */
    498         RTR0MEMOBJ                  pMemObjVMCB;
    499         /** Physical address of the VM control block (VMCB). */
    500         RTHCPHYS                    pVMCBPhys;
    501         /** Virtual address of the VM control block (VMCB). */
    502         R0PTRTYPE(void *)           pVMCB;
    503 
    504         /** Ring 0 handlers for VT-x. */
    505         DECLR0CALLBACKMEMBER(int, pfnVMRun,(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx));
    506 
    507     } svm;
    508 
    509 #if HC_ARCH_BITS == 32
    510     uint32_t                        Alignment;
    511 #endif
    512 
    513     /** Event injection state. */
    514     struct
    515     {
    516         uint32_t                    fPending;
    517         uint32_t                    errCode;
    518         uint64_t                    intInfo;
    519     } Event;
    520 
    521518} HWACCMCPU;
    522519/** Pointer to HWACCM VM instance data. */
  • trunk/src/VBox/VMM/VMMAll/HWACCMAll.cpp

    r13883 r13898  
    5454{
    5555#ifdef IN_RING0
    56     PVMCPU pVCpu = &pVM->aCpus[HWACCMGetVMCPUId(pVM)];
     56    PVMCPU pVCpu = VMMGetCpu(pVM);
    5757    if (pVM->hwaccm.s.vmx.fSupported)
    5858        return VMXR0InvalidatePage(pVM, pVCpu, GCVirt);
     
    7373VMMDECL(int) HWACCMFlushTLB(PVM pVM)
    7474{
     75    PVMCPU pVCpu = VMMGetCpu(pVM);
     76
    7577    LogFlow(("HWACCMFlushTLB\n"));
    7678
    77     pVM->aCpus[HWACCMGetVMCPUId(pVM)].hwaccm.s.fForceTLBFlush = true;
    78     STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushTLBManual);
     79    pVCpu->hwaccm.s.fForceTLBFlush = true;
     80    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBManual);
    7981    return VINF_SUCCESS;
    8082}
     
    121123
    122124#ifdef IN_RING0
    123     PVMCPU pVCpu = &pVM->aCpus[HWACCMGetVMCPUId(pVM)];
     125    PVMCPU pVCpu = VMMGetCpu(pVM);
    124126    if (pVM->hwaccm.s.vmx.fSupported)
    125127        return VMXR0InvalidatePhysPage(pVM, pVCpu, GCPhys);
     
    141143VMMDECL(bool) HWACCMHasPendingIrq(PVM pVM)
    142144{
    143     /* @todo SMP */
    144     return !!pVM->aCpus[0].hwaccm.s.Event.fPending;
     145    PVMCPU pVCpu = VMMGetCpu(pVM);
     146    return !!pVCpu->hwaccm.s.Event.fPending;
    145147}
    146148
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r13818 r13898  
    6767    PVM pVM = pCritSect->s.CTX_SUFF(pVM);
    6868    Assert(pVM);
    69 
    70     RTCPUID idCPU = VM_GET_VMCPUID(pVM);
     69    PVMCPU pVCpu = VMMGetCpu(pVM);
    7170
    7271    /*
     
    7675    {
    7776        pCritSect->s.Core.cNestings = 1;
    78         Assert(pVM->aCpus[idCPU].hNativeThread);
    79         ASMAtomicXchgSize(&pCritSect->s.Core.NativeThreadOwner, pVM->aCpus[idCPU].hNativeThread);
     77        Assert(pVCpu->hNativeThread);
     78        ASMAtomicXchgSize(&pCritSect->s.Core.NativeThreadOwner, pVCpu->hNativeThread);
    8079        STAM_PROFILE_ADV_START(&pCritSect->s.StatLocked, l);
    8180        return VINF_SUCCESS;
     
    8584     * Nested?
    8685     */
    87     if (pCritSect->s.Core.NativeThreadOwner == pVM->aCpus[idCPU].hNativeThread)
     86    if (pCritSect->s.Core.NativeThreadOwner == pVCpu->hNativeThread)
    8887    {
    8988        pCritSect->s.Core.cNestings++;
     
    163162    PVM pVM = pCritSect->s.CTX_SUFF(pVM);
    164163    Assert(pVM);
    165     AssertMsg(pCritSect->s.Core.NativeThreadOwner == pVM->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread, ("Owner %RX64 emt=%RX64\n", pCritSect->s.Core.NativeThreadOwner, pVM->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread));
     164    PVMCPU pVCpu = VMMGetCpu(pVM);
     165    Assert(pVCpu);
     166    AssertMsg(pCritSect->s.Core.NativeThreadOwner == pVCpu->hNativeThread, ("Owner %RX64 emt=%RX64\n", pCritSect->s.Core.NativeThreadOwner, pVCpu->hNativeThread));
    166167
    167168    /*
     
    187188
    188189        /* darn, someone raced in on us. */
    189         Assert(pVM->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread);
    190         ASMAtomicXchgSize(&pCritSect->s.Core.NativeThreadOwner, pVM->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread);
     190        Assert(pVCpu->hNativeThread);
     191        ASMAtomicXchgSize(&pCritSect->s.Core.NativeThreadOwner, pVCpu->hNativeThread);
    191192        STAM_PROFILE_ADV_START(&pCritSect->s.StatLocked, l);
    192193    }
     
    222223    PVM pVM = pCritSect->s.CTX_SUFF(pVM);
    223224    Assert(pVM);
    224     return pCritSect->s.Core.NativeThreadOwner == pVM->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread;
     225    return pCritSect->s.Core.NativeThreadOwner == VMMGetCpu(pVM)->hNativeThread;
    225226#endif
    226227}
  • trunk/src/VBox/VMM/VMMAll/VMMAll.cpp

    r13832 r13898  
    2929#include <VBox/vm.h>
    3030#include <VBox/param.h>
     31#include <VBox/hwaccm.h>
    3132
    3233
     
    5758VMCPUID VMMGetCpuId(PVM pVM)
    5859{
    59 #ifdef VBOX_WITH_SMP_GUESTS
    6060    /* Only emulation thread(s) allowed to ask for CPU id */
    6161    VM_ASSERT_EMT(pVM);
    6262
    63 # if defined(IN_RC)
     63#if defined(IN_RC)
    6464    /* There is only one CPU if we're in GC. */
    6565    return 0;
    6666
    67 # elif defined(IN_RING3)
     67#elif defined(IN_RING3)
    6868    return VMR3GetVMCPUId(pVM);
    6969
    70 # else  /* IN_RING0 */
    71     /** @todo SMP: Get the real CPU ID and use a table in the VM structure to
    72      *  translate it. */
    73     return 0;
    74 # endif /* IN_RING0 */
    75 
    76 #else
    77     VM_ASSERT_EMT(pVM);
    78     return 0;
    79 #endif
     70#else  /* IN_RING0 */
     71    return HWACCMGetVMCPUId(pVM);
     72#endif /* IN_RING0 */
    8073}
    8174
     75/**
     76 * Returns the VMCPU of the current EMT thread.
     77 *
     78 * @returns The VMCPU pointer.
     79 * @param   pVM         The VM to operate on.
     80 */
     81PVMCPU VMMGetCpu(PVM pVM)
     82{
     83    /* Only emulation thread(s) allowed to ask for CPU id */
     84    VM_ASSERT_EMT(pVM);
     85
     86#if defined(IN_RC)
     87    /* There is only one CPU if we're in GC. */
     88    return &pVM->aCpus[0];
     89
     90#elif defined(IN_RING3)
     91    return &pVM->aCpus[VMR3GetVMCPUId(pVM)];
     92
     93#else  /* IN_RING0 */
     94    return &pVM->aCpus[HWACCMGetVMCPUId(pVM)];
     95#endif /* IN_RING0 */
     96}
    8297
    8398/**
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp

    r13883 r13898  
    774774    pVM->hwaccm.s.cpuid.u32AMDFeatureEDX    = HWACCMR0Globals.cpuid.u32AMDFeatureEDX;
    775775    pVM->hwaccm.s.lLastError                = HWACCMR0Globals.lLastError;
     776
     777    pVM->hwaccm.s.uMaxASID                  = HWACCMR0Globals.uMaxASID;
     778
     779    for (unsigned i=0;i<pVM->cCPUs;i++)
     780    {
     781        PVMCPU pVCpu = &pVM->aCpus[i];
     782
    776783#ifdef VBOX_STRICT
    777     pVM->hwaccm.s.idEnteredCpu              = NIL_RTCPUID;
     784        pVCpu->hwaccm.s.idEnteredCpu              = NIL_RTCPUID;
    778785#endif
    779 
    780     pVM->hwaccm.s.uMaxASID                  = HWACCMR0Globals.uMaxASID;
    781 
    782     for (unsigned i=0;i<pVM->cCPUs;i++)
    783     {
    784786        /* Invalidate the last cpu we were running on. */
    785         pVM->aCpus[i].hwaccm.s.idLastCpu                 = NIL_RTCPUID;
     787        pVCpu->hwaccm.s.idLastCpu                 = NIL_RTCPUID;
    786788
    787789        /* we'll aways increment this the first time (host uses ASID 0) */
    788         pVM->aCpus[i].hwaccm.s.uCurrentASID              = 0;
     790        pVCpu->hwaccm.s.uCurrentASID              = 0;
    789791    }
    790792
     
    916918    if (RT_SUCCESS(rc))
    917919    {
    918         AssertMsg(pVM->hwaccm.s.idEnteredCpu == NIL_RTCPUID, ("%d", (int)pVM->hwaccm.s.idEnteredCpu));
    919         pVM->hwaccm.s.idEnteredCpu = idCpu;
     920        AssertMsg(pVCpu->hwaccm.s.idEnteredCpu == NIL_RTCPUID, ("%d", (int)pVCpu->hwaccm.s.idEnteredCpu));
     921        pVCpu->hwaccm.s.idEnteredCpu = idCpu;
    920922    }
    921923#endif
     
    959961#ifdef VBOX_STRICT
    960962    /* keep track of the CPU owning the VMCS for debugging scheduling weirdness and ring-3 calls. */
    961     AssertMsg(pVM->hwaccm.s.idEnteredCpu == idCpu, ("owner is %d, I'm %d", (int)pVM->hwaccm.s.idEnteredCpu, (int)idCpu));
    962     pVM->hwaccm.s.idEnteredCpu = NIL_RTCPUID;
     963    AssertMsg(pVCpu->hwaccm.s.idEnteredCpu == idCpu, ("owner is %d, I'm %d", (int)pVCpu->hwaccm.s.idEnteredCpu, (int)idCpu));
     964    pVCpu->hwaccm.s.idEnteredCpu = NIL_RTCPUID;
    963965#endif
    964966
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r13883 r13898  
    405405
    406406        Log(("Reinjecting event %08x %08x at %RGv\n", pVCpu->hwaccm.s.Event.intInfo, pVCpu->hwaccm.s.Event.errCode, (RTGCPTR)pCtx->rip));
    407         STAM_COUNTER_INC(&pVM->hwaccm.s.StatIntReinject);
     407        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntReinject);
    408408        Event.au64[0] = pVCpu->hwaccm.s.Event.intInfo;
    409409        SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
     
    448448                /* Can only happen in rare cases where a pending interrupt is cleared behind our back */
    449449                Assert(!VM_FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)));
    450                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatSwitchGuestIrq);
     450                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchGuestIrq);
    451451                /* Just continue */
    452452            }
     
    514514            Event.n.u3Type = SVM_EVENT_EXTERNAL_IRQ;
    515515
    516         STAM_COUNTER_INC(&pVM->hwaccm.s.StatIntInject);
     516        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntInject);
    517517        SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
    518518    } /* if (interrupts can be dispatched) */
     
    716716            &&  !DBGFIsStepping(pVM))
    717717        {
    718             STAM_COUNTER_INC(&pVM->hwaccm.s.StatDRxArmed);
     718            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxArmed);
    719719
    720720            /* Disable drx move intercepts. */
     
    766766    {
    767767        pVMCB->ctrl.u32InterceptCtrl1 &= ~SVM_CTRL1_INTERCEPT_RDTSC;
    768         STAM_COUNTER_INC(&pVM->hwaccm.s.StatTSCOffset);
     768        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatTSCOffset);
    769769    }
    770770    else
    771771    {
    772772        pVMCB->ctrl.u32InterceptCtrl1 |= SVM_CTRL1_INTERCEPT_RDTSC;
    773         STAM_COUNTER_INC(&pVM->hwaccm.s.StatTSCIntercept);
     773        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatTSCIntercept);
    774774    }
    775775
     
    817817#endif
    818818
    819     STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatEntry, x);
     819    STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatEntry, x);
    820820
    821821    pVMCB = (SVM_VMCB *)pVCpu->hwaccm.s.svm.pVMCB;
     
    830830    if (++cResume > HWACCM_MAX_RESUME_LOOPS)
    831831    {
    832         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitMaxResume);
     832        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitMaxResume);
    833833        rc = VINF_EM_RAW_INTERRUPT;
    834834        goto end;
     
    866866        {
    867867            VM_FF_CLEAR(pVM, VM_FF_TO_R3);
    868             STAM_COUNTER_INC(&pVM->hwaccm.s.StatSwitchToR3);
    869             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     868            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3);
     869            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    870870            rc = VINF_EM_RAW_TO_R3;
    871871            goto end;
     
    876876    if (VM_FF_ISPENDING(pVM, VM_FF_REQUEST))
    877877    {
    878         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     878        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    879879        rc = VINF_EM_PENDING_REQUEST;
    880880        goto end;
     
    886886    if (RT_FAILURE(rc))
    887887    {
    888         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     888        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    889889        goto end;
    890890    }
     
    917917
    918918    /* All done! Let's start VM execution. */
    919     STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatInGC, x);
     919    STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatInGC, x);
    920920
    921921    /* Enable nested paging if necessary (disabled each time after #VMEXIT). */
     
    949949    if (rc != VINF_SUCCESS)
    950950    {
    951         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     951        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    952952        goto end;
    953953    }
     
    981981        }
    982982        else
    983             STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushASID);
     983            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushASID);
    984984
    985985        pVCpu->hwaccm.s.cTLBFlushes  = pCpu->cTLBFlushes;
     
    10041004#ifdef VBOX_WITH_STATISTICS
    10051005    if (pVMCB->ctrl.TLBCtrl.n.u1TLBFlush)
    1006         STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushTLBWorldSwitch);
     1006        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBWorldSwitch);
    10071007    else
    1008         STAM_COUNTER_INC(&pVM->hwaccm.s.StatNoFlushTLBWorldSwitch);
     1008        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch);
    10091009#endif
    10101010
     
    10361036    pVCpu->hwaccm.s.svm.pfnVMRun(pVM->hwaccm.s.svm.pVMCBHostPhys, pVCpu->hwaccm.s.svm.pVMCBPhys, pCtx);
    10371037    TMNotifyEndOfExecution(pVM);
    1038     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatInGC, x);
     1038    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatInGC, x);
    10391039
    10401040    /*
     
    10441044     */
    10451045
    1046     STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatExit, x);
     1046    STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatExit, x);
    10471047
    10481048    /* Reason for the VM exit */
     
    12661266#ifdef VBOX_WITH_STATISTICS
    12671267    if (exitCode == SVM_EXIT_NPF)
    1268         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitReasonNPF);
     1268        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitReasonNPF);
    12691269    else
    1270         STAM_COUNTER_INC(&pVM->hwaccm.s.paStatExitReasonR0[exitCode & MASK_EXITREASON_STAT]);
     1270        STAM_COUNTER_INC(&pVCpu->hwaccm.s.paStatExitReasonR0[exitCode & MASK_EXITREASON_STAT]);
    12711271#endif
    12721272
     
    12981298        case X86_XCPT_DB:
    12991299        {
    1300             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestDB);
     1300            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestDB);
    13011301
    13021302            /* Note that we don't support guest and host-initiated debugging at the same time. */
     
    13161316                SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
    13171317
    1318                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1318                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    13191319                goto ResumeExecution;
    13201320            }
     
    13331333            {
    13341334                Assert(CPUMIsGuestFPUStateActive(pVM));
    1335                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitShadowNM);
     1335                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowNM);
    13361336
    13371337                /* Continue execution. */
    1338                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1338                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    13391339                pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR0;
    13401340
     
    13431343
    13441344            Log(("Forward #NM fault to the guest\n"));
    1345             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestNM);
     1345            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNM);
    13461346
    13471347            Event.au64[0]    = 0;
     
    13511351
    13521352            SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
    1353             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1353            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    13541354            goto ResumeExecution;
    13551355        }
     
    13661366                 */
    13671367                Log(("Guest page fault at %RGv cr2=%RGv error code %x rsp=%RGv\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode, (RTGCPTR)pCtx->rsp));
    1368                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestPF);
     1368                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF);
    13691369
    13701370                /* Now we must update CR2. */
     
    13801380                SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
    13811381
    1382                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1382                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    13831383                goto ResumeExecution;
    13841384            }
     
    13981398            {   /* We've successfully synced our shadow pages, so let's just continue execution. */
    13991399                Log2(("Shadow page fault at %RGv cr2=%RGv error code %x\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode));
    1400                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitShadowPF);
     1400                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF);
    14011401
    14021402                TRPMResetTrap(pVM);
    14031403
    1404                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1404                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    14051405                goto ResumeExecution;
    14061406            }
     
    14111411                 */
    14121412                Log2(("Forward page fault to the guest\n"));
    1413                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestPF);
     1413                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF);
    14141414                /* The error code might have been changed. */
    14151415                errCode = TRPMGetErrorCode(pVM);
     
    14291429                SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
    14301430
    1431                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1431                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    14321432                goto ResumeExecution;
    14331433            }
     
    14431443        case X86_XCPT_MF: /* Floating point exception. */
    14441444        {
    1445             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestMF);
     1445            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestMF);
    14461446            if (!(pCtx->cr0 & X86_CR0_NE))
    14471447            {
     
    14601460            SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
    14611461
    1462             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1462            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    14631463            goto ResumeExecution;
    14641464        }
     
    14791479            {
    14801480            case X86_XCPT_GP:
    1481                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestGP);
     1481                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestGP);
    14821482                Event.n.u1ErrorCodeValid    = 1;
    14831483                Event.n.u32ErrorCode        = pVMCB->ctrl.u64ExitInfo1; /* EXITINFO1 = error code */
    14841484                break;
    14851485            case X86_XCPT_DE:
    1486                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestDE);
     1486                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestDE);
    14871487                break;
    14881488            case X86_XCPT_UD:
    1489                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestUD);
     1489                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestUD);
    14901490                break;
    14911491            case X86_XCPT_SS:
    1492                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestSS);
     1492                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestSS);
    14931493                Event.n.u1ErrorCodeValid    = 1;
    14941494                Event.n.u32ErrorCode        = pVMCB->ctrl.u64ExitInfo1; /* EXITINFO1 = error code */
    14951495                break;
    14961496            case X86_XCPT_NP:
    1497                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestNP);
     1497                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNP);
    14981498                Event.n.u1ErrorCodeValid    = 1;
    14991499                Event.n.u32ErrorCode        = pVMCB->ctrl.u64ExitInfo1; /* EXITINFO1 = error code */
     
    15031503            SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
    15041504
    1505             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1505            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    15061506            goto ResumeExecution;
    15071507        }
     
    15351535        {   /* We've successfully synced our shadow pages, so let's just continue execution. */
    15361536            Log2(("Shadow page fault at %RGv cr2=%RGp error code %x\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode));
    1537             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitShadowPF);
     1537            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF);
    15381538
    15391539            TRPMResetTrap(pVM);
    15401540
    1541             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1541            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    15421542            goto ResumeExecution;
    15431543        }
     
    15701570    case SVM_EXIT_WBINVD:
    15711571    case SVM_EXIT_INVD:                 /* Guest software attempted to execute INVD. */
    1572         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitInvd);
     1572        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInvd);
    15731573        /* Skip instruction and continue directly. */
    15741574        pCtx->rip += 2;     /* Note! hardcoded opcode size! */
    15751575        /* Continue execution.*/
    1576         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1576        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    15771577        goto ResumeExecution;
    15781578
     
    15801580    {
    15811581        Log2(("SVM: Cpuid at %RGv for %x\n", (RTGCPTR)pCtx->rip, pCtx->eax));
    1582         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitCpuid);
     1582        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCpuid);
    15831583        rc = EMInterpretCpuId(pVM, CPUMCTX2CORE(pCtx));
    15841584        if (rc == VINF_SUCCESS)
     
    15861586            /* Update EIP and continue execution. */
    15871587            pCtx->rip += 2;             /* Note! hardcoded opcode size! */
    1588             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1588            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    15891589            goto ResumeExecution;
    15901590        }
     
    15971597    {
    15981598        Log2(("SVM: Rdtsc\n"));
    1599         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitRdtsc);
     1599        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitRdtsc);
    16001600        rc = EMInterpretRdtsc(pVM, CPUMCTX2CORE(pCtx));
    16011601        if (rc == VINF_SUCCESS)
     
    16031603            /* Update EIP and continue execution. */
    16041604            pCtx->rip += 2;             /* Note! hardcoded opcode size! */
    1605             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1605            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    16061606            goto ResumeExecution;
    16071607        }
     
    16141614    {
    16151615        Log2(("SVM: invlpg\n"));
    1616         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitInvpg);
     1616        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInvpg);
    16171617
    16181618        Assert(!pVM->hwaccm.s.fNestedPaging);
     
    16221622        if (rc == VINF_SUCCESS)
    16231623        {
    1624             STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushPageInvlpg);
     1624            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushPageInvlpg);
    16251625            goto ResumeExecution;   /* eip already updated */
    16261626        }
     
    16361636
    16371637        Log2(("SVM: %RGv mov cr%d, \n", (RTGCPTR)pCtx->rip, exitCode - SVM_EXIT_WRITE_CR0));
    1638         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitCRxWrite);
     1638        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCRxWrite);
    16391639        rc = EMInterpretInstruction(pVM, CPUMCTX2CORE(pCtx), 0, &cbSize);
    16401640
     
    16651665            AssertRC(rc);
    16661666
    1667             STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushTLBCRxChange);
     1667            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBCRxChange);
    16681668
    16691669            /* Must be set by PGMSyncCR3 */
     
    16751675
    16761676            /* Only resume if successful. */
    1677             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1677            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    16781678            goto ResumeExecution;
    16791679        }
     
    16901690
    16911691        Log2(("SVM: %RGv mov x, cr%d\n", (RTGCPTR)pCtx->rip, exitCode - SVM_EXIT_READ_CR0));
    1692         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitCRxRead);
     1692        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCRxRead);
    16931693        rc = EMInterpretInstruction(pVM, CPUMCTX2CORE(pCtx), 0, &cbSize);
    16941694        if (rc == VINF_SUCCESS)
     
    16971697
    16981698            /* Only resume if successful. */
    1699             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1699            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    17001700            goto ResumeExecution;
    17011701        }
     
    17121712
    17131713        Log2(("SVM: %RGv mov dr%d, x\n", (RTGCPTR)pCtx->rip, exitCode - SVM_EXIT_WRITE_DR0));
    1714         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitDRxRead);
     1714        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxRead);
    17151715
    17161716        if (!DBGFIsStepping(pVM))
    17171717        {
    1718             STAM_COUNTER_INC(&pVM->hwaccm.s.StatDRxContextSwitch);
     1718            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxContextSwitch);
    17191719
    17201720            /* Disable drx move intercepts. */
     
    17261726            AssertRC(rc);
    17271727
    1728             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1728            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    17291729            goto ResumeExecution;
    17301730        }
     
    17371737
    17381738            /* Only resume if successful. */
    1739             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1739            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    17401740            goto ResumeExecution;
    17411741        }
     
    17521752
    17531753        Log2(("SVM: %RGv mov dr%d, x\n", (RTGCPTR)pCtx->rip, exitCode - SVM_EXIT_READ_DR0));
    1754         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitDRxRead);
     1754        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxRead);
    17551755
    17561756        if (!DBGFIsStepping(pVM))
    17571757        {
    1758             STAM_COUNTER_INC(&pVM->hwaccm.s.StatDRxContextSwitch);
     1758            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxContextSwitch);
    17591759
    17601760            /* Disable drx move intercepts. */
     
    17661766            AssertRC(rc);
    17671767
    1768             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1768            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    17691769            goto ResumeExecution;
    17701770        }
     
    17761776
    17771777            /* Only resume if successful. */
    1778             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1778            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    17791779            goto ResumeExecution;
    17801780        }
     
    18261826            {
    18271827                Log2(("IOMInterpretOUTSEx %RGv %x size=%d\n", (RTGCPTR)pCtx->rip, IoExitInfo.n.u16Port, uIOSize));
    1828                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitIOStringWrite);
     1828                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOStringWrite);
    18291829                rc = IOMInterpretOUTSEx(pVM, CPUMCTX2CORE(pCtx), IoExitInfo.n.u16Port, prefix, uIOSize);
    18301830            }
     
    18321832            {
    18331833                Log2(("IOMInterpretINSEx  %RGv %x size=%d\n", (RTGCPTR)pCtx->rip, IoExitInfo.n.u16Port, uIOSize));
    1834                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitIOStringRead);
     1834                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOStringRead);
    18351835                rc = IOMInterpretINSEx(pVM, CPUMCTX2CORE(pCtx), IoExitInfo.n.u16Port, prefix, uIOSize);
    18361836            }
     
    18441844            {
    18451845                Log2(("IOMIOPortWrite %RGv %x %x size=%d\n", (RTGCPTR)pCtx->rip, IoExitInfo.n.u16Port, pCtx->eax & uAndVal, uIOSize));
    1846                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitIOWrite);
     1846                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOWrite);
    18471847                rc = IOMIOPortWrite(pVM, IoExitInfo.n.u16Port, pCtx->eax & uAndVal, uIOSize);
    18481848            }
     
    18511851                uint32_t u32Val = 0;
    18521852
    1853                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitIORead);
     1853                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIORead);
    18541854                rc = IOMIOPortRead(pVM, IoExitInfo.n.u16Port, &u32Val, uIOSize);
    18551855                if (IOM_SUCCESS(rc))
     
    18741874                if (pCtx->dr[7] & X86_DR7_ENABLED_MASK)
    18751875                {
    1876                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatDRxIOCheck);
     1876                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxIOCheck);
    18771877                    for (unsigned i=0;i<4;i++)
    18781878                    {
     
    19171917                            SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
    19181918
    1919                             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1919                            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    19201920                            goto ResumeExecution;
    19211921                        }
     
    19231923                }
    19241924
    1925                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1925                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    19261926                goto ResumeExecution;
    19271927            }
     
    19741974        SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event);
    19751975
    1976         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1976        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    19771977        goto ResumeExecution;
    19781978    }
     
    19911991
    19921992            /* Only resume if successful. */
    1993             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1993            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    19941994            goto ResumeExecution;
    19951995        }
     
    20352035    if (exitCode == SVM_EXIT_INTR)
    20362036    {
    2037         STAM_COUNTER_INC(&pVM->hwaccm.s.StatPendingHostIrq);
     2037        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatPendingHostIrq);
    20382038        /* On the next entry we'll only sync the host context. */
    20392039        pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_HOST_CONTEXT;
     
    20512051        rc = VINF_EM_RAW_EMULATE_INSTR;
    20522052
    2053     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2053    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    20542054    return rc;
    20552055}
     
    22202220        AssertMsgReturn(pVMCB, ("Invalid pVMCB\n"), VERR_EM_INTERNAL_ERROR);
    22212221
    2222         STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushPageManual);
     2222        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushPageManual);
    22232223        SVMInvlpgA(GCVirt, pVMCB->ctrl.TLBCtrl.n.u32ASID);
    22242224    }
     
    22402240    /* invlpga only invalidates TLB entries for guest virtual addresses; we have no choice but to force a TLB flush here. */
    22412241    pVCpu->hwaccm.s.fForceTLBFlush = true;
    2242     STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushTLBInvlpga);
     2242    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBInvlpga);
    22432243    return VINF_SUCCESS;
    22442244}
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r13883 r13898  
    655655    {
    656656        Log(("Reinjecting event %RX64 %08x at %RGv cr2=%RX64\n", pVCpu->hwaccm.s.Event.intInfo, pVCpu->hwaccm.s.Event.errCode, (RTGCPTR)pCtx->rip, pCtx->cr2));
    657         STAM_COUNTER_INC(&pVM->hwaccm.s.StatIntReinject);
     657        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntReinject);
    658658        rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, pVCpu->hwaccm.s.Event.intInfo, 0, pVCpu->hwaccm.s.Event.errCode);
    659659        AssertRC(rc);
     
    694694                /* Can only happen in rare cases where a pending interrupt is cleared behind our back */
    695695                Assert(!VM_FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)));
    696                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatSwitchGuestIrq);
     696                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchGuestIrq);
    697697                /* Just continue */
    698698            }
     
    759759            intInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
    760760
    761         STAM_COUNTER_INC(&pVM->hwaccm.s.StatIntInject);
     761        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntInject);
    762762        rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo, 0, errCode);
    763763        AssertRC(rc);
     
    13291329            &&  !DBGFIsStepping(pVM))
    13301330        {
    1331             STAM_COUNTER_INC(&pVM->hwaccm.s.StatDRxArmed);
     1331            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxArmed);
    13321332
    13331333            /* Disable drx move intercepts. */
     
    13891389        rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls);
    13901390        AssertRC(rc);
    1391         STAM_COUNTER_INC(&pVM->hwaccm.s.StatTSCOffset);
     1391        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatTSCOffset);
    13921392    }
    13931393    else
     
    13961396        rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls);
    13971397        AssertRC(rc);
    1398         STAM_COUNTER_INC(&pVM->hwaccm.s.StatTSCIntercept);
     1398        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatTSCIntercept);
    13991399    }
    14001400
     
    16141614#ifdef VBOX_WITH_STATISTICS
    16151615    if (pVCpu->hwaccm.s.fForceTLBFlush)
    1616         STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushTLBWorldSwitch);
     1616        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBWorldSwitch);
    16171617    else
    1618         STAM_COUNTER_INC(&pVM->hwaccm.s.StatNoFlushTLBWorldSwitch);
     1618        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch);
    16191619#endif
    16201620}
     
    16631663        else
    16641664        {
    1665             STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushASID);
     1665            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushASID);
    16661666            pVCpu->hwaccm.s.fForceTLBFlush     = false;
    16671667        }
     
    16891689#ifdef VBOX_WITH_STATISTICS
    16901690    if (pVCpu->hwaccm.s.fForceTLBFlush)
    1691         STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushTLBWorldSwitch);
     1691        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBWorldSwitch);
    16921692    else
    1693         STAM_COUNTER_INC(&pVM->hwaccm.s.StatNoFlushTLBWorldSwitch);
     1693        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch);
    16941694#endif
    16951695}
     
    17211721    Log2(("\nE"));
    17221722
    1723     STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatEntry, x);
     1723    STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatEntry, x);
    17241724
    17251725#ifdef VBOX_STRICT
     
    17821782     */
    17831783ResumeExecution:
    1784     AssertMsg(pVM->hwaccm.s.idEnteredCpu == RTMpCpuId(),
     1784    AssertMsg(pVCpu->hwaccm.s.idEnteredCpu == RTMpCpuId(),
    17851785              ("Expected %d, I'm %d; cResume=%d exitReason=%RTreg exitQualification=%RTreg\n",
    1786                (int)pVM->hwaccm.s.idEnteredCpu, (int)RTMpCpuId(), cResume, exitReason, exitQualification));
     1786               (int)pVCpu->hwaccm.s.idEnteredCpu, (int)RTMpCpuId(), cResume, exitReason, exitQualification));
    17871787    Assert(!HWACCMR0SuspendPending());
    17881788
     
    17901790    if (++cResume > HWACCM_MAX_RESUME_LOOPS)
    17911791    {
    1792         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitMaxResume);
     1792        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitMaxResume);
    17931793        rc = VINF_EM_RAW_INTERRUPT;
    17941794        goto end;
     
    18231823    {
    18241824        VM_FF_CLEAR(pVM, VM_FF_TO_R3);
    1825         STAM_COUNTER_INC(&pVM->hwaccm.s.StatSwitchToR3);
    1826         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     1825        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3);
     1826        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    18271827        rc = VINF_EM_RAW_TO_R3;
    18281828        goto end;
     
    18311831    if (VM_FF_ISPENDING(pVM, VM_FF_REQUEST))
    18321832    {
    1833         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     1833        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    18341834        rc = VINF_EM_PENDING_REQUEST;
    18351835        goto end;
     
    18411841    if (RT_FAILURE(rc))
    18421842    {
    1843         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     1843        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    18441844        goto end;
    18451845    }
     
    19131913    if (rc != VINF_SUCCESS)
    19141914    {
    1915         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     1915        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    19161916        goto end;
    19171917    }
     
    19201920    if (rc != VINF_SUCCESS)
    19211921    {
    1922         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     1922        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    19231923        goto end;
    19241924    }
     
    19321932    AssertRC(rc);
    19331933
    1934     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     1934    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    19351935
    19361936    /* Manual save and restore:
     
    19471947
    19481948    /* All done! Let's start VM execution. */
    1949     STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatInGC, x);
     1949    STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatInGC, x);
    19501950#ifdef VBOX_STRICT
    19511951    Assert(idCpuCheck == RTMpCpuId());
     
    19651965     */
    19661966
    1967     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatInGC, x);
    1968     STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatExit, x);
     1967    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatInGC, x);
     1968    STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatExit, x);
    19691969
    19701970    if (rc != VINF_SUCCESS)
     
    19771977    /* Investigate why there was a VM-exit. */
    19781978    rc  = VMXReadVMCS(VMX_VMCS_RO_EXIT_REASON, &exitReason);
    1979     STAM_COUNTER_INC(&pVM->hwaccm.s.paStatExitReasonR0[exitReason & MASK_EXITREASON_STAT]);
     1979    STAM_COUNTER_INC(&pVCpu->hwaccm.s.paStatExitReasonR0[exitReason & MASK_EXITREASON_STAT]);
    19801980
    19811981    exitReason &= 0xffff;   /* bit 0-15 contain the exit code. */
     
    20842084                    Assert(CPUMIsGuestFPUStateActive(pVM));
    20852085
    2086                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitShadowNM);
     2086                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowNM);
    20872087
    20882088                    /* Continue execution. */
    2089                     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2089                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    20902090                    pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR0;
    20912091
     
    20942094
    20952095                Log(("Forward #NM fault to the guest\n"));
    2096                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestNM);
     2096                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNM);
    20972097                rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, 0);
    20982098                AssertRC(rc);
    2099                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2099                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    21002100                goto ResumeExecution;
    21012101            }
     
    21122112                    Assert(CPUMIsGuestInPagedProtectedModeEx(pCtx));
    21132113
    2114                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestPF);
     2114                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF);
    21152115
    21162116                    /* Now we must update CR2. */
     
    21192119                    AssertRC(rc);
    21202120
    2121                     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2121                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    21222122                    goto ResumeExecution;
    21232123                }
     
    21372137                {   /* We've successfully synced our shadow pages, so let's just continue execution. */
    21382138                    Log2(("Shadow page fault at %RGv cr2=%RGv error code %x\n", (RTGCPTR)pCtx->rip, exitQualification ,errCode));
    2139                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitShadowPF);
     2139                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF);
    21402140
    21412141                    TRPMResetTrap(pVM);
    21422142
    2143                     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2143                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    21442144                    goto ResumeExecution;
    21452145                }
     
    21512151                    Log2(("Forward page fault to the guest\n"));
    21522152
    2153                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestPF);
     2153                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF);
    21542154                    /* The error code might have been changed. */
    21552155                    errCode = TRPMGetErrorCode(pVM);
     
    21622162                    AssertRC(rc);
    21632163
    2164                     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2164                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    21652165                    goto ResumeExecution;
    21662166                }
     
    21762176            case X86_XCPT_MF: /* Floating point exception. */
    21772177            {
    2178                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestMF);
     2178                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestMF);
    21792179                if (!(pCtx->cr0 & X86_CR0_NE))
    21802180                {
     
    21882188                AssertRC(rc);
    21892189
    2190                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2190                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    21912191                goto ResumeExecution;
    21922192            }
     
    22052205                 * 63:15    Reserved (0)
    22062206                 */
    2207                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestDB);
     2207                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestDB);
    22082208
    22092209                /* Note that we don't support guest and host-initiated debugging at the same time. */
     
    22362236                    AssertRC(rc);
    22372237
    2238                     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2238                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    22392239                    goto ResumeExecution;
    22402240                }
     
    22472247                uint32_t cbSize;
    22482248
    2249                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestGP);
     2249                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestGP);
    22502250#ifdef VBOX_STRICT
    22512251                if (!CPUMIsGuestInRealModeEx(pCtx))
     
    22542254                    rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
    22552255                    AssertRC(rc);
    2256                     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2256                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    22572257                    goto ResumeExecution;
    22582258                }
     
    22702270
    22712271                    /* Only resume if successful. */
    2272                     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2272                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    22732273                    goto ResumeExecution;
    22742274                }
     
    22862286                {
    22872287                case X86_XCPT_DE:
    2288                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestDE);
     2288                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestDE);
    22892289                    break;
    22902290                case X86_XCPT_UD:
    2291                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestUD);
     2291                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestUD);
    22922292                    break;
    22932293                case X86_XCPT_SS:
    2294                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestSS);
     2294                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestSS);
    22952295                    break;
    22962296                case X86_XCPT_NP:
    2297                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestNP);
     2297                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNP);
    22982298                    break;
    22992299                }
     
    23032303                AssertRC(rc);
    23042304
    2305                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2305                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    23062306                goto ResumeExecution;
    23072307            }
     
    23202320                        break;
    23212321
    2322                     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2322                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    23232323                    goto ResumeExecution;
    23242324                }
     
    23852385        {   /* We've successfully synced our shadow pages, so let's just continue execution. */
    23862386            Log2(("Shadow page fault at %RGv cr2=%RGp error code %x\n", (RTGCPTR)pCtx->rip, exitQualification , errCode));
    2387             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitShadowPF);
     2387            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF);
    23882388
    23892389            TRPMResetTrap(pVM);
    23902390
    2391             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2391            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    23922392            goto ResumeExecution;
    23932393        }
     
    24082408        rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls);
    24092409        AssertRC(rc);
    2410         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitIrqWindow);
     2410        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIrqWindow);
    24112411        goto ResumeExecution;   /* we check for pending guest interrupts there */
    24122412
    24132413    case VMX_EXIT_WBINVD:               /* 54 Guest software attempted to execute WBINVD. (conditional) */
    24142414    case VMX_EXIT_INVD:                 /* 13 Guest software attempted to execute INVD. (unconditional) */
    2415         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitInvd);
     2415        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInvd);
    24162416        /* Skip instruction and continue directly. */
    24172417        pCtx->rip += cbInstr;
    24182418        /* Continue execution.*/
    2419         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2419        STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    24202420        goto ResumeExecution;
    24212421
     
    24232423    {
    24242424        Log2(("VMX: Cpuid %x\n", pCtx->eax));
    2425         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitCpuid);
     2425        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCpuid);
    24262426        rc = EMInterpretCpuId(pVM, CPUMCTX2CORE(pCtx));
    24272427        if (rc == VINF_SUCCESS)
     
    24302430            Assert(cbInstr == 2);
    24312431            pCtx->rip += cbInstr;
    2432             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2432            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    24332433            goto ResumeExecution;
    24342434        }
     
    24412441    {
    24422442        Log2(("VMX: Rdtsc\n"));
    2443         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitRdtsc);
     2443        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitRdtsc);
    24442444        rc = EMInterpretRdtsc(pVM, CPUMCTX2CORE(pCtx));
    24452445        if (rc == VINF_SUCCESS)
     
    24482448            Assert(cbInstr == 2);
    24492449            pCtx->rip += cbInstr;
    2450             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2450            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    24512451            goto ResumeExecution;
    24522452        }
     
    24612461        Assert(!pVM->hwaccm.s.fNestedPaging);
    24622462
    2463         STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitInvpg);
     2463        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInvpg);
    24642464        rc = EMInterpretInvlpg(pVM, CPUMCTX2CORE(pCtx), exitQualification);
    24652465        if (rc == VINF_SUCCESS)
     
    24672467            /* Update EIP and continue execution. */
    24682468            pCtx->rip += cbInstr;
    2469             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2469            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    24702470            goto ResumeExecution;
    24712471        }
     
    24872487
    24882488            /* Only resume if successful. */
    2489             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2489            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    24902490            goto ResumeExecution;
    24912491        }
     
    25002500        case VMX_EXIT_QUALIFICATION_CRX_ACCESS_WRITE:
    25012501            Log2(("VMX: %RGv mov cr%d, x\n", (RTGCPTR)pCtx->rip, VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification)));
    2502             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitCRxWrite);
     2502            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCRxWrite);
    25032503            rc = EMInterpretCRxWrite(pVM, CPUMCTX2CORE(pCtx),
    25042504                                     VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification),
     
    25392539        case VMX_EXIT_QUALIFICATION_CRX_ACCESS_READ:
    25402540            Log2(("VMX: mov x, crx\n"));
    2541             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitCRxRead);
     2541            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCRxRead);
    25422542
    25432543            Assert(!pVM->hwaccm.s.fNestedPaging || !CPUMIsGuestInPagedProtectedModeEx(pCtx) || VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification) != USE_REG_CR3);
     
    25532553        case VMX_EXIT_QUALIFICATION_CRX_ACCESS_CLTS:
    25542554            Log2(("VMX: clts\n"));
    2555             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitCLTS);
     2555            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCLTS);
    25562556            rc = EMInterpretCLTS(pVM);
    25572557            pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR0;
     
    25602560        case VMX_EXIT_QUALIFICATION_CRX_ACCESS_LMSW:
    25612561            Log2(("VMX: lmsw %x\n", VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(exitQualification)));
    2562             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitLMSW);
     2562            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitLMSW);
    25632563            rc = EMInterpretLMSW(pVM, CPUMCTX2CORE(pCtx), VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(exitQualification));
    25642564            pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR0;
     
    25732573        {
    25742574            /* Only resume if successful. */
    2575             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2575            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    25762576            goto ResumeExecution;
    25772577        }
     
    25942594
    25952595#ifdef VBOX_WITH_STATISTICS
    2596             STAM_COUNTER_INC(&pVM->hwaccm.s.StatDRxContextSwitch);
     2596            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxContextSwitch);
    25972597            if (VMX_EXIT_QUALIFICATION_DRX_DIRECTION(exitQualification) == VMX_EXIT_QUALIFICATION_DRX_DIRECTION_WRITE)
    2598                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitDRxWrite);
     2598                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxWrite);
    25992599            else
    2600                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitDRxRead);
    2601 #endif
    2602 
    2603             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2600                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxRead);
     2601#endif
     2602
     2603            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    26042604            goto ResumeExecution;
    26052605        }
     
    26092609        {
    26102610            Log2(("VMX: mov drx%d, genreg%d\n", VMX_EXIT_QUALIFICATION_DRX_REGISTER(exitQualification), VMX_EXIT_QUALIFICATION_DRX_GENREG(exitQualification)));
    2611             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitDRxWrite);
     2611            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxWrite);
    26122612            rc = EMInterpretDRxWrite(pVM, CPUMCTX2CORE(pCtx),
    26132613                                     VMX_EXIT_QUALIFICATION_DRX_REGISTER(exitQualification),
     
    26192619        {
    26202620            Log2(("VMX: mov x, drx\n"));
    2621             STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitDRxRead);
     2621            STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxRead);
    26222622            rc = EMInterpretDRxRead(pVM, CPUMCTX2CORE(pCtx),
    26232623                                    VMX_EXIT_QUALIFICATION_DRX_GENREG(exitQualification),
     
    26312631        {
    26322632            /* Only resume if successful. */
    2633             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2633            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    26342634            goto ResumeExecution;
    26352635        }
     
    26722672            {
    26732673                Log2(("IOMInterpretOUTSEx %RGv %x size=%d\n", (RTGCPTR)pCtx->rip, uPort, cbSize));
    2674                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitIOStringWrite);
     2674                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOStringWrite);
    26752675                rc = IOMInterpretOUTSEx(pVM, CPUMCTX2CORE(pCtx), uPort, prefix, cbSize);
    26762676            }
     
    26782678            {
    26792679                Log2(("IOMInterpretINSEx  %RGv %x size=%d\n", (RTGCPTR)pCtx->rip, uPort, cbSize));
    2680                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitIOStringRead);
     2680                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOStringRead);
    26812681                rc = IOMInterpretINSEx(pVM, CPUMCTX2CORE(pCtx), uPort, prefix, cbSize);
    26822682            }
     
    26912691            if (fIOWrite)
    26922692            {
    2693                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitIOWrite);
     2693                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOWrite);
    26942694                rc = IOMIOPortWrite(pVM, uPort, pCtx->eax & uAndVal, cbSize);
    26952695            }
     
    26982698                uint32_t u32Val = 0;
    26992699
    2700                 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitIORead);
     2700                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIORead);
    27012701                rc = IOMIOPortRead(pVM, uPort, &u32Val, cbSize);
    27022702                if (IOM_SUCCESS(rc))
     
    27202720                if (pCtx->dr[7] & X86_DR7_ENABLED_MASK)
    27212721                {
    2722                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatDRxIOCheck);
     2722                    STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxIOCheck);
    27232723                    for (unsigned i=0;i<4;i++)
    27242724                    {
     
    27662766                            AssertRC(rc);
    27672767
    2768                             STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2768                            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    27692769                            goto ResumeExecution;
    27702770                        }
     
    27722772                }
    27732773
    2774                 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2774                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    27752775                goto ResumeExecution;
    27762776            }
     
    29522952        &&  !VMX_EXIT_INTERRUPTION_INFO_VALID(intInfo))
    29532953    {
    2954         STAM_COUNTER_INC(&pVM->hwaccm.s.StatPendingHostIrq);
     2954        STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatPendingHostIrq);
    29552955        /* On the next entry we'll only sync the host context. */
    29562956        pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_HOST_CONTEXT;
     
    29752975    }
    29762976
    2977     STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     2977    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x);
    29782978
    29792979    Log2(("X"));
  • trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp

    r13885 r13898  
    265265    CHECK_MEMBER_ALIGNMENT(HWACCM, vmx.hostCR4, 8);
    266266    CHECK_MEMBER_ALIGNMENT(HWACCM, vmx.msr.feature_ctrl, 8);
    267     CHECK_MEMBER_ALIGNMENT(HWACCM, StatEntry, 8);
     267    CHECK_MEMBER_ALIGNMENT(HWACCMCPU, StatEntry, 8);
    268268    CHECK_MEMBER_ALIGNMENT(HWACCMCPU, vmx.proc_ctls, 8);
    269269    CHECK_MEMBER_ALIGNMENT(HWACCMCPU, Event.intInfo, 8);
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