VirtualBox

Changeset 100139 in vbox


Ignore:
Timestamp:
Jun 9, 2023 2:31:28 PM (23 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
157832
Message:

VMM/HM: More statistics for HMCanExecuteVmxGuest, making sure all return cases are coverted.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/HMVMXAll.cpp

    r98103 r100139  
    746746                    }
    747747                }
     748                STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckPmOk);
    748749            }
    749750        }
     
    756757                    /* Requires a fake TSS for real mode - stored in the VMM device heap: */
    757758                    || CPUMIsGuestInRealModeEx(pCtx))
     759                {
     760                    STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheck1);
    758761                    return false;
     762                }
    759763
    760764                /* Too early for VT-x; Solaris guests will fail with a guru meditation otherwise; same for XP. */
    761765                if (pCtx->idtr.pIdt == 0 || pCtx->idtr.cbIdt == 0 || pCtx->tr.Sel == 0)
     766                {
     767                    STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheck1);
    762768                    return false;
     769                }
    763770
    764771                /*
     
    769776                /** @todo Is this supposed recompiler bug still relevant with IEM? */
    770777                if (pCtx->cs.Attr.n.u1Present == 0)
     778                {
     779                    STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheck1);
    771780                    return false;
     781                }
    772782                if (pCtx->ss.Attr.n.u1Present == 0)
     783                {
     784                    STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheck1);
    773785                    return false;
     786                }
    774787
    775788                /*
     
    781794                 *        stack segment into account. But, it does the job for now. */
    782795                if (pCtx->rsp >= pCtx->ss.u32Limit)
     796                {
     797                    STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheck1);
    783798                    return false;
     799                }
    784800            }
    785801        }
     
    805821        }
    806822        if ((pCtx->cr0 & uCr0Mask) != uCr0Mask)
     823        {
     824            STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheck2);
    807825            return false;
     826        }
    808827
    809828        /* If bit N is cleared in cr0_fixed1, then it must be zero in the guest's cr0. */
    810829        uCr0Mask = (uint32_t)~CTX_EXPR(pVM->hm.s.ForR3.vmx.Msrs.u64Cr0Fixed1, g_HmMsrs.u.vmx.u64Cr0Fixed1, RT_NOTHING);
    811830        if ((pCtx->cr0 & uCr0Mask) != 0)
     831        {
     832            STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheck2);
    812833            return false;
     834        }
    813835
    814836        /* If bit N is set in cr4_fixed0, then it must be set in the guest's cr4. */
     
    816838        uCr0Mask &= ~X86_CR4_VMXE;
    817839        if ((pCtx->cr4 & uCr0Mask) != uCr0Mask)
     840        {
     841            STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheck2);
    818842            return false;
     843        }
    819844
    820845        /* If bit N is cleared in cr4_fixed1, then it must be zero in the guest's cr4. */
    821846        uCr0Mask = (uint32_t)~CTX_EXPR(pVM->hm.s.ForR3.vmx.Msrs.u64Cr4Fixed1, g_HmMsrs.u.vmx.u64Cr4Fixed1, RT_NOTHING);
    822847        if ((pCtx->cr4 & uCr0Mask) != 0)
     848        {
     849            STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheck2);
    823850            return false;
     851        }
    824852
    825853        pVCpu->hm.s.fActive = true;
     854        STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckOk);
    826855        return true;
    827856    }
    828857
     858    STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckDisabled);
    829859    return false;
    830860}
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r99809 r100139  
    976976        HM_REG_COUNTER(&pHmCpu->StatVmxCheckBadRpl,         "/HM/CPU%u/VMXCheck/RPL", "Could not use VMX due to unsuitable RPL.");
    977977        HM_REG_COUNTER(&pHmCpu->StatVmxCheckPmOk,           "/HM/CPU%u/VMXCheck/VMX_PM", "VMX execution in protected mode OK.");
     978        HM_REG_COUNTER(&pHmCpu->StatVmxCheck1,              "/HM/CPU%u/VMXCheck/1", "Could not use VMX due to unsuitable state and no VMMDev heap");
     979        HM_REG_COUNTER(&pHmCpu->StatVmxCheck2,              "/HM/CPU%u/VMXCheck/2", "CR0/CR4 fixed stuff.");
     980        HM_REG_COUNTER(&pHmCpu->StatVmxCheckDisabled,       "/HM/CPU%u/VMXCheck/Disabled", "VMX is not enabled.");
     981        HM_REG_COUNTER(&pHmCpu->StatVmxCheckOk,             "/HM/CPU%u/VMXCheck/Ok", "We could do VMX!");
    978982#endif
    979983        if (fCpuSupportsVmx)
  • trunk/src/VBox/VMM/include/HMInternal.h

    r99208 r100139  
    991991    STAMCOUNTER             StatVmxCheckBadRpl;
    992992    STAMCOUNTER             StatVmxCheckPmOk;
     993    STAMCOUNTER             StatVmxCheck1;
     994    STAMCOUNTER             StatVmxCheck2;
     995    STAMCOUNTER             StatVmxCheckDisabled;
     996    STAMCOUNTER             StatVmxCheckOk;
    993997
    994998    STAMCOUNTER             StatVmxPreemptionRecalcingDeadline;
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