Changeset 101096 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Sep 12, 2023 10:59:30 PM (17 months ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp
r101091 r101096 788 788 pTbAllocator->cTotalTbs += cTbsPerChunk; 789 789 790 if ( idxChunk* cTbsPerChunk >= cInitialTbs)790 if ((idxChunk + 1) * cTbsPerChunk >= cInitialTbs) 791 791 break; 792 792 } … … 1003 1003 STAM_PROFILE_START(&pTbAllocator->StatPrune, a); 1004 1004 uint32_t const msNow = pVCpu->iem.s.msRecompilerPollNow; 1005 uint32_t const cTbsToPrune = 128; 1006 uint32_t const cTbsPerGroup = 4; 1005 1007 uint32_t cFreedTbs = 0; 1006 1008 #ifdef IEMTB_SIZE_IS_POWER_OF_TWO 1007 uint32_t idxTbPruneFrom = pTbAllocator->iPruneFrom & ~(uint32_t) 3;1009 uint32_t idxTbPruneFrom = pTbAllocator->iPruneFrom & ~(uint32_t)(cTbsToPrune - 1); /* Stay within a chunk! */ 1008 1010 #else 1009 1011 uint32_t idxTbPruneFrom = pTbAllocator->iPruneFrom; 1010 1012 #endif 1011 if (idxTbPruneFrom > pTbAllocator->cMaxTbs)1013 if (idxTbPruneFrom >= pTbAllocator->cMaxTbs) 1012 1014 idxTbPruneFrom = 0; 1013 for (uint32_t i = 0; i < 128; i += 4, idxTbPruneFrom += 4)1015 for (uint32_t i = 0; i < cTbsToPrune; i += cTbsPerGroup, idxTbPruneFrom += cTbsPerGroup) 1014 1016 { 1015 1017 uint32_t idxChunk = IEMTBALLOC_IDX_TO_CHUNK(pTbAllocator, idxTbPruneFrom); … … 1017 1019 PIEMTB pTb = &pTbAllocator->aChunks[idxChunk].paTbs[idxInChunk]; 1018 1020 uint32_t cMsAge = msNow - pTb->msLastUsed; 1019 for (uint32_t j = 1, idxChunk2 = idxChunk, idxInChunk2 = idxInChunk + 1; j < 4; j++, idxInChunk2++)1021 for (uint32_t j = 1, idxChunk2 = idxChunk, idxInChunk2 = idxInChunk + 1; j < cTbsPerGroup; j++, idxInChunk2++) 1020 1022 { 1021 1023 #ifndef IEMTB_SIZE_IS_POWER_OF_TWO -
trunk/src/VBox/VMM/VMMR3/IEMR3.cpp
r101088 r101096 116 116 117 117 #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 127 118 /** @cfgm{/IEM/MaxTbCount, uint32_t, 524288} 128 119 * Max number of TBs per EMT. */ … … 130 121 rc = CFGMR3QueryU32Def(pIem, "MaxTbCount", &cMaxTbs, _512K); 131 122 AssertLogRelRCReturn(rc, rc); 132 if (cMaxTbs < cInitialTbs|| cMaxTbs > _8M)123 if (cMaxTbs < _16K || cMaxTbs > _8M) 133 124 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); 135 142 #endif 136 143 … … 285 292 286 293 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/cTbAlloc s", idCpu);289 STAMR3RegisterF(pVM, (void *)&pTbAllocator->StatFrees, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_ OCCURENCES,290 "Translation block frees", "/IEM/CPU%u/re/cTbFree s", 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); 291 298 # ifdef VBOX_WITH_STATISTICS 292 299 STAMR3RegisterF(pVM, (void *)&pTbAllocator->StatPrune, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL,
Note:
See TracChangeset
for help on using the changeset viewer.