VirtualBox

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


Ignore:
Timestamp:
Sep 12, 2023 10:59:30 PM (17 months ago)
Author:
vboxsync
Message:

VMM/IEM: Fixed a bug in the TB allocator pruning code and another one wrt initial chunk allocations. bugref:10369

File:
1 edited

Legend:

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

    r101088 r101096  
    116116
    117117#ifdef VBOX_WITH_IEM_RECOMPILER
    118     /** @cfgm{/IEM/InitialTbCount, uint32_t, 32768}
    119      * Initial (minimum) number of TBs per EMT in ring-3. */
    120     uint32_t cInitialTbs = 0;
    121     rc = CFGMR3QueryU32Def(pIem, "InitialTbCount", &cInitialTbs, _32K);
    122     AssertLogRelRCReturn(rc, rc);
    123     if (cInitialTbs < _16K || cInitialTbs > _8M)
    124         return VMSetError(pVM, VERR_OUT_OF_RANGE, RT_SRC_POS,
    125                           "InitialTbCount value %u (%#x) is out of range (min %u, max %u)", cInitialTbs, cInitialTbs, _16K, _8M);
    126 
    127118    /** @cfgm{/IEM/MaxTbCount, uint32_t, 524288}
    128119     * Max number of TBs per EMT. */
     
    130121    rc = CFGMR3QueryU32Def(pIem, "MaxTbCount", &cMaxTbs, _512K);
    131122    AssertLogRelRCReturn(rc, rc);
    132     if (cMaxTbs < cInitialTbs || cMaxTbs > _8M)
     123    if (cMaxTbs < _16K || cMaxTbs > _8M)
    133124        return VMSetError(pVM, VERR_OUT_OF_RANGE, RT_SRC_POS,
    134                           "MaxTbCount value %u (%#x) is out of range (min %u, max %u)", cMaxTbs, cMaxTbs, cInitialTbs, _8M);
     125                          "MaxTbCount value %u (%#x) is out of range (min %u, max %u)", cMaxTbs, cMaxTbs, _16K, _8M);
     126
     127    /** @cfgm{/IEM/InitialTbCount, uint32_t, 32678}
     128     * Initial (minimum) number of TBs per EMT in ring-3. */
     129    uint32_t cInitialTbs = 0;
     130    rc = CFGMR3QueryU32Def(pIem, "InitialTbCount", &cInitialTbs, RT_MIN(cMaxTbs, _32K));
     131    AssertLogRelRCReturn(rc, rc);
     132    if (cInitialTbs < _16K || cInitialTbs > _8M)
     133        return VMSetError(pVM, VERR_OUT_OF_RANGE, RT_SRC_POS,
     134                          "InitialTbCount value %u (%#x) is out of range (min %u, max %u)", cInitialTbs, cInitialTbs, _16K, _8M);
     135
     136    /* Check that the two values makes sense together. Expect user/api to do
     137       the right thing or get lost. */
     138    if (cInitialTbs > cMaxTbs)
     139        return VMSetError(pVM, VERR_OUT_OF_RANGE, RT_SRC_POS,
     140                          "InitialTbCount value %u (%#x) is higher than the MaxTbCount value %u (%#x)",
     141                          cInitialTbs, cInitialTbs, cMaxTbs, cMaxTbs);
    135142#endif
    136143
     
    285292
    286293        PIEMTBALLOCATOR const pTbAllocator = pVCpu->iem.s.pTbAllocatorR3;
    287         STAMR3RegisterF(pVM, (void *)&pTbAllocator->StatAllocs,         STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
    288                         "Translation block allocations",                "/IEM/CPU%u/re/cTbAllocs", idCpu);
    289         STAMR3RegisterF(pVM, (void *)&pTbAllocator->StatFrees,          STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
    290                         "Translation block frees",                      "/IEM/CPU%u/re/cTbFrees", idCpu);
     294        STAMR3RegisterF(pVM, (void *)&pTbAllocator->StatAllocs,         STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS,
     295                        "Translation block allocations",                "/IEM/CPU%u/re/cTbAllocCalls", idCpu);
     296        STAMR3RegisterF(pVM, (void *)&pTbAllocator->StatFrees,          STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS, STAMUNIT_CALLS,
     297                        "Translation block frees",                      "/IEM/CPU%u/re/cTbFreeCalls", idCpu);
    291298# ifdef VBOX_WITH_STATISTICS
    292299        STAMR3RegisterF(pVM, (void *)&pTbAllocator->StatPrune,          STAMTYPE_PROFILE,   STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL,
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