VirtualBox

Changeset 19707 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
May 14, 2009 5:36:11 PM (16 years ago)
Author:
vboxsync
Message:

GVMM: Count EMTs instead of VMs to determin if we've got company or not. (scheduling)

File:
1 edited

Legend:

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

    r19660 r19707  
    115115//    /** The number of halted EMT threads. */
    116116//    uint16_t volatile   cHaltedEMTs;
     117    /** The number of EMTs. */
     118    uint32_t volatile   cEMTs;
    117119    /** The lock used to serialize VM creation, destruction and associated events that
    118120     * isn't performance critical. Owners may acquire the list lock. */
     
    127129    GVMHANDLE           aHandles[GVMM_MAX_HANDLES];
    128130
    129     /** @gcfgm{/GVMM/cVMsMeansCompany, 32-bit, 0, UINT32_MAX, 1}
    130      * The number of VMs that means we no longer consider ourselves alone on a CPU/Core.
    131      */
    132     uint32_t            cVMsMeansCompany;
     131    /** @gcfgm{/GVMM/cEMTsMeansCompany, 32-bit, 0, UINT32_MAX, 1}
     132     * The number of EMTs that means we no longer consider ourselves alone on a
     133     * CPU/Core.
     134     */
     135    uint32_t            cEMTsMeansCompany;
    133136    /** @gcfgm{/GVMM/MinSleepAlone,32-bit, 0, 100000000, 750000, ns}
    134137     * The minimum sleep time for when we're alone, in nano seconds.
     
    243246
    244247            /* The default configuration values. */
    245             pGVMM->cVMsMeansCompany = 1;                           /** @todo should be adjusted to relative to the cpu count or something... */
     248            pGVMM->cEMTsMeansCompany = 1;                           /** @todo should be adjusted to relative to the cpu count or something... */
    246249            pGVMM->nsMinSleepAlone   = 750000 /* ns (0.750 ms) */;  /** @todo this should be adjusted to be 75% (or something) of the scheduler granularity... */
    247250            pGVMM->nsMinSleepCompany =  15000 /* ns (0.015 ms) */;
     
    291294    if (pGVMM->iUsedHead)
    292295    {
    293         SUPR0Printf("GVMMR0Term: iUsedHead=%#x! (cVMs=%#x)\n", pGVMM->iUsedHead, pGVMM->cVMs);
     296        SUPR0Printf("GVMMR0Term: iUsedHead=%#x! (cVMs=%#x cEMTs=%#x)\n", pGVMM->iUsedHead, pGVMM->cVMs, pGVMM->cEMTs);
    294297        pGVMM->iUsedHead = 0;
    295298    }
     
    325328    int rc = VINF_SUCCESS;
    326329    pszName += sizeof("/GVMM/") - 1;
    327     if (!strcmp(pszName, "cVMsMeansCompany"))
     330    if (!strcmp(pszName, "cEMTsMeansCompany"))
    328331    {
    329332        if (u64Value <= UINT32_MAX)
    330             pGVMM->cVMsMeansCompany = u64Value;
     333            pGVMM->cEMTsMeansCompany = u64Value;
    331334        else
    332335            rc = VERR_OUT_OF_RANGE;
     
    393396    int rc = VINF_SUCCESS;
    394397    pszName += sizeof("/GVMM/") - 1;
    395     if (!strcmp(pszName, "cVMsMeansCompany"))
    396         *pu64Value = pGVMM->cVMsMeansCompany;
     398    if (!strcmp(pszName, "cEMTsMeansCompany"))
     399        *pu64Value = pGVMM->cEMTsMeansCompany;
    397400    else if (!strcmp(pszName, "MinSleepAlone"))
    398401        *pu64Value = pGVMM->nsMinSleepAlone;
     
    655658                                        pGVM->pVM           = pVM;
    656659                                        pGVM->aCpus[0].hEMT = hEMT0;
     660                                        pGVMM->cEMTs += cCpus;
    657661
    658662                                        gvmmR0UsedUnlock(pGVMM);
     
    9971001    pGVMM->cVMs--;
    9981002
    999     gvmmR0UsedUnlock(pGVMM);
    1000 
    10011003    /*
    10021004     * Do the global cleanup round.
     
    10061008        &&  pGVM->u32Magic == GVM_MAGIC)
    10071009    {
     1010        pGVMM->cEMTs -= pGVM->cCpus;
     1011        gvmmR0UsedUnlock(pGVMM);
     1012
    10081013        gvmmR0CleanupVM(pGVM);
    10091014
     
    10481053        pGVM->u32Magic |= UINT32_C(0x80000000);
    10491054        RTMemFree(pGVM);
    1050     }
    1051     /* else: GVMMR0CreateVM cleanup.  */
     1055
     1056        /* Re-acquire the UsedLock before freeing the handle since we're updating handle fields. */
     1057        rc = gvmmR0UsedLock(pGVMM);
     1058        AssertRC(rc);
     1059    }
     1060    /* else: GVMMR0CreateVM cleanup. */
    10521061
    10531062    /*
    10541063     * Free the handle.
    1055      * Reacquire the UsedLock here to since we're updating handle fields.
    1056      */
    1057     rc = gvmmR0UsedLock(pGVMM);
    1058     AssertRC(rc);
    1059 
     1064     */
    10601065    pHandle->iNext = pGVMM->iFreeHead;
    10611066    pGVMM->iFreeHead = iHandle;
     
    15371542     */
    15381543    if (    u64Now < u64ExpireGipTime
    1539         &&  u64ExpireGipTime - u64Now > (pGVMM->cVMs > pGVMM->cVMsMeansCompany
     1544        &&  u64ExpireGipTime - u64Now > (pGVMM->cEMTs > pGVMM->cEMTsMeansCompany
    15401545                                         ? pGVMM->nsMinSleepCompany
    15411546                                         : pGVMM->nsMinSleepAlone))
     
    19211926     */
    19221927    pStats->cVMs = 0;
     1928    pStats->cEMTs = 0;
    19231929    memset(&pStats->SchedSum, 0, sizeof(pStats->SchedSum));
    19241930
     
    19351941        {
    19361942            pStats->cVMs++;
     1943            pStats->cEMTs += pGVM->cCpus;
    19371944
    19381945            pStats->SchedSum.cHaltCalls        += pGVM->gvmm.s.StatsSched.cHaltCalls;
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