VirtualBox

Changeset 48565 in vbox


Ignore:
Timestamp:
Sep 19, 2013 10:16:00 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
89117
Message:

VMM/HM: Added total VM-exits STAM.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/hm.h

    r48562 r48565  
    7171#define VMCPU_HMCF_IS_PENDING(pVCpu, fFlags)    RT_BOOL((pVCpu)->hm.s.fContextUseFlags & (fFlags))
    7272
     73/** @def VMCPU_HMCF_RESET_TO
     74 * Resets the HM-context flags to the specified value.
     75 *
     76 * @param   pVCpu   Pointer to the VMCPU.
     77 * @param   fFlags  The reset value.
     78 */
     79#define VMCPU_HMCF_RESET_TO(pVCpu, fFlags)      ((pVCpu)->hm.s.fContextUseFlags = (fFlags))
     80
    7381/**
    7482 * Checks whether HM (VT-x/AMD-V) is being used by this VM.
     
    8290 */
    8391#if defined(VBOX_STRICT) && defined(IN_RING3)
    84 # define HMIsEnabled(a_pVM)   HMIsEnabledNotMacro(a_pVM)
     92# define HMIsEnabled(a_pVM)                 HMIsEnabledNotMacro(a_pVM)
    8593#else
    86 # define HMIsEnabled(a_pVM)   ((a_pVM)->fHMEnabled)
     94# define HMIsEnabled(a_pVM)                 ((a_pVM)->fHMEnabled)
    8795#endif
    8896
     
    98106 */
    99107#if HC_ARCH_BITS == 64
    100 # define HMIsRawModeCtxNeeded(a_pVM)   (!HMIsEnabled(a_pVM))
     108# define HMIsRawModeCtxNeeded(a_pVM)        (!HMIsEnabled(a_pVM))
    101109#else
    102 # define HMIsRawModeCtxNeeded(a_pVM)   (!HMIsEnabled(a_pVM) || (a_pVM)->fHMNeedRawModeCtx)
     110# define HMIsRawModeCtxNeeded(a_pVM)        (!HMIsEnabled(a_pVM) || (a_pVM)->fHMNeedRawModeCtx)
    103111#endif
    104112
     
    110118 * @internal
    111119 */
    112 #define HMCanEmulateIoBlock(a_pVCpu)     (!CPUMIsGuestInPagedProtectedMode(a_pVCpu))
     120#define HMCanEmulateIoBlock(a_pVCpu)        (!CPUMIsGuestInPagedProtectedMode(a_pVCpu))
    113121
    114122 /**
     
    119127 * @internal
    120128 */
    121 #define HMCanEmulateIoBlockEx(a_pCtx)   (!CPUMIsGuestInPagedProtectedModeEx(a_pCtx))
     129#define HMCanEmulateIoBlockEx(a_pCtx)       (!CPUMIsGuestInPagedProtectedModeEx(a_pCtx))
    122130
    123131/**
     
    128136 */
    129137#ifdef IN_RING0
    130 # define HMIsInHwVirtCtx(a_pVCpu)       (VMCPU_GET_STATE(a_pVCpu) == VMCPUSTATE_STARTED_HM)
     138# define HMIsInHwVirtCtx(a_pVCpu)           (VMCPU_GET_STATE(a_pVCpu) == VMCPUSTATE_STARTED_HM)
    131139#else
    132 # define HMIsInHwVirtCtx(a_pVCpu)       (false)
     140# define HMIsInHwVirtCtx(a_pVCpu)           (false)
    133141#endif
    134142
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r48555 r48565  
    4444#ifdef VBOX_WITH_STATISTICS
    4545# define HMSVM_EXITCODE_STAM_COUNTER_INC(u64ExitCode) do { \
     46        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitAll); \
    4647        if ((u64ExitCode) == SVM_EXIT_NPF) \
    4748            STAM_COUNTER_INC(&pVCpu->hm.s.StatExitReasonNpf); \
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r48552 r48565  
    78007800        /* Handle the VM-exit. */
    78017801        AssertMsg(VmxTransient.uExitReason <= VMX_EXIT_MAX, ("%#x\n", VmxTransient.uExitReason));
     7802        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitAll);
    78027803        STAM_COUNTER_INC(&pVCpu->hm.s.paStatExitReasonR0[VmxTransient.uExitReason & MASK_EXITREASON_STAT]);
    78037804        STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatExit1, &pVCpu->hm.s.StatExit2, x);
     
    78747875        /* Handle the VM-exit. */
    78757876        AssertMsg(VmxTransient.uExitReason <= VMX_EXIT_MAX, ("%#x\n", VmxTransient.uExitReason));
     7877        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitAll);
    78767878        STAM_COUNTER_INC(&pVCpu->hm.s.paStatExitReasonR0[VmxTransient.uExitReason & MASK_EXITREASON_STAT]);
    78777879        STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatExit1, &pVCpu->hm.s.StatExit2, x);
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r48556 r48565  
    647647
    648648#ifdef VBOX_WITH_STATISTICS
     649        HM_REG_COUNTER(&pVCpu->hm.s.StatExitAll,                "/HM/CPU%d/Exit/All", "Exits (total).");
    649650        HM_REG_COUNTER(&pVCpu->hm.s.StatExitShadowNM,           "/HM/CPU%d/Exit/Trap/Shw/#NM", "Shadow #NM (device not available, no math co-processor) exception.");
    650651        HM_REG_COUNTER(&pVCpu->hm.s.StatExitGuestNM,            "/HM/CPU%d/Exit/Trap/Gst/#NM", "Guest #NM (device not available, no math co-processor) exception.");
     
    16281629VMMR3_INT_DECL(void) HMR3ResetCpu(PVMCPU pVCpu)
    16291630{
    1630     /* Sync. entire state on VM reset R0-reentry. It's safe to update
     1631    /* Sync. entire state on VM reset R0-reentry. It's safe to reset
    16311632       the HM flags here, all other EMTs are in ring-3. See VMR3Reset(). */
    1632     pVCpu->hm.s.fContextUseFlags = (HM_CHANGED_HOST_CONTEXT | HM_CHANGED_ALL_GUEST);
     1633    VMCPU_HMCF_RESET_TO(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_ALL_GUEST);
    16331634
    16341635    pVCpu->hm.s.vmx.u32CR0Mask     = 0;
     
    26482649VMMR3_INT_DECL(void) HMR3NotifyScheduled(PVMCPU pVCpu)
    26492650{
    2650     pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_ALL_GUEST;
     2651    VMCPU_HMCF_SET(pVCpu, HM_CHANGED_ALL_GUEST);
    26512652}
    26522653
     
    26592660VMMR3_INT_DECL(void) HMR3NotifyEmulated(PVMCPU pVCpu)
    26602661{
    2661     pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_ALL_GUEST;
     2662    VMCPU_HMCF_SET(pVCpu, HM_CHANGED_ALL_GUEST);
    26622663}
    26632664
  • trunk/src/VBox/VMM/include/HMInternal.h

    r48284 r48565  
    771771    STAMCOUNTER             StatInjectPendingReflect;
    772772
     773    STAMCOUNTER             StatExitAll;
    773774    STAMCOUNTER             StatExitShadowNM;
    774775    STAMCOUNTER             StatExitGuestNM;
Note: See TracChangeset for help on using the changeset viewer.

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