- Timestamp:
- Dec 1, 2008 3:20:06 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGM.cpp
r14861 r14868 1603 1603 STAM_REG(pVM, &pPGM->StatR0DynMapMigrateInvlPg, STAMTYPE_COUNTER, "/PGM/R0/DynMapMigrateInvlPg", STAMUNIT_OCCURENCES, "invlpg count in PGMDynMapMigrateAutoSet."); 1604 1604 STAM_REG(pVM, &pPGM->StatR0DynMapPage, STAMTYPE_COUNTER, "/PGM/R0/DynMapPage", STAMUNIT_OCCURENCES, "Calls to pgmR0DynMapPage"); 1605 STAM_REG(pVM, &pPGM->StatR0DynMapPageHit0, STAMTYPE_COUNTER, "/PGM/R0/DynMapPage/Hit0", STAMUNIT_OCCURENCES, "Hit at iPage+0"); 1606 STAM_REG(pVM, &pPGM->StatR0DynMapPageHit1, STAMTYPE_COUNTER, "/PGM/R0/DynMapPage/Hit1", STAMUNIT_OCCURENCES, "Hit at iPage+1"); 1607 STAM_REG(pVM, &pPGM->StatR0DynMapPageHit2, STAMTYPE_COUNTER, "/PGM/R0/DynMapPage/Hit2", STAMUNIT_OCCURENCES, "Hit at iPage+2"); 1608 STAM_REG(pVM, &pPGM->StatR0DynMapPageHit3, STAMTYPE_COUNTER, "/PGM/R0/DynMapPage/Hit3", STAMUNIT_OCCURENCES, "Hit at iPage+3"); 1605 1609 STAM_REG(pVM, &pPGM->StatR0DynMapPageInvlPg, STAMTYPE_COUNTER, "/PGM/R0/DynMapPage/InvlPg", STAMUNIT_OCCURENCES, "invlpg count in pgmR0DynMapPageSlow."); 1606 1610 STAM_REG(pVM, &pPGM->StatR0DynMapPageSlow, STAMTYPE_COUNTER, "/PGM/R0/DynMapPage/Slow", STAMUNIT_OCCURENCES, "Calls to pgmR0DynMapPageSlow - subtract this from pgmR0DynMapPage to get 1st level hits."); -
trunk/src/VBox/VMM/PGMInternal.h
r14861 r14868 2567 2567 STAMCOUNTER StatR0DynMapMigrateInvlPg; /**< R0: invlpg in PGMDynMapMigrateAutoSet. */ 2568 2568 STAMCOUNTER StatR0DynMapPage; /**< R0: Calls to pgmR0DynMapPage. */ 2569 STAMCOUNTER StatR0DynMapPageHit0; /**< R0: Hit at iPage+0. */ 2570 STAMCOUNTER StatR0DynMapPageHit1; /**< R0: Hit at iPage+1. */ 2571 STAMCOUNTER StatR0DynMapPageHit2; /**< R0: Hit at iPage+2. */ 2572 STAMCOUNTER StatR0DynMapPageHit3; /**< R0: Hit at iPage+3. */ 2569 2573 STAMCOUNTER StatR0DynMapPageInvlPg; /**< R0: invlpg. */ 2570 2574 STAMCOUNTER StatR0DynMapPageSlow; /**< R0: Calls to pgmR0DynMapPageSlow. */ -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r14755 r14868 3233 3233 Assert(pgmShwGet32BitPDEPtr(&pVM->pgm.s, (uint32_t)iPD << SHW_PD_SHIFT) == pPDEDst); 3234 3234 # elif PGM_SHW_TYPE == PGM_TYPE_PAE 3235 # if def VBOX_STRICT3235 # if defined(VBOX_STRICT) && !defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) /* Unfortuantely not reliable with PGMR0DynMap and multiple VMs. */ 3236 3236 RTGCPTR GCPtrStrict = (uint32_t)iPD << GST_PD_SHIFT; 3237 3237 # if PGM_GST_TYPE == PGM_TYPE_PAE -
trunk/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp
r14861 r14868 1174 1174 1175 1175 /* 1176 * Check if any of the first 5pages are unreferenced since the caller1176 * Check if any of the first 4 pages are unreferenced since the caller 1177 1177 * already has made sure they aren't matching. 1178 1178 */ … … 1191 1191 else if (!paPages[(iPage + 3) % cPages].cRefs) 1192 1192 iFreePage = (iPage + 3) % cPages; 1193 else if (!paPages[(iPage + 4) % cPages].cRefs)1194 iFreePage = (iPage + 4) % cPages;1195 1193 else 1196 1194 { … … 1198 1196 * Search for an unused or matching entry. 1199 1197 */ 1200 iFreePage = (iPage + 5) % cPages;1198 iFreePage = (iPage + 4) % cPages; 1201 1199 for (;;) 1202 1200 { … … 1224 1222 /* Check for lost hits. */ 1225 1223 if (!fLooped) 1226 for (uint32_t iPage2 = (iPage + 5) % cPages; iPage2 != iPage; iPage2 = (iPage2 + 1) % cPages)1224 for (uint32_t iPage2 = (iPage + 4) % cPages; iPage2 != iPage; iPage2 = (iPage2 + 1) % cPages) 1227 1225 if (paPages[iPage2].HCPhys == HCPhys) 1228 1226 STAM_COUNTER_INC(&pVM->pgm.s.StatR0DynMapPageSlowLostHits); … … 1281 1279 * Find an entry, if possible a matching one. The HCPhys address is hashed 1282 1280 * down to a page index, collisions are handled by linear searching. Optimize 1283 * for a hit in the first 5pages.1281 * for a hit in the first 4 pages. 1284 1282 * 1285 1283 * To the cheap hits here and defer the tedious searching and inserting … … 1289 1287 uint32_t iPage = (HCPhys >> PAGE_SHIFT) % cPages; 1290 1288 PPGMR0DYNMAPENTRY paPages = pThis->paPages; 1291 if (paPages[iPage].HCPhys != HCPhys) 1292 { 1293 uint32_t iPage2 = (iPage + 1) % cPages; 1294 if (paPages[iPage2].HCPhys != HCPhys) 1289 if (RT_LIKELY(paPages[iPage].HCPhys == HCPhys)) 1290 STAM_COUNTER_INC(&pVM->pgm.s.StatR0DynMapPageHit0); 1291 else 1292 { 1293 uint32_t iPage2 = (iPage + 1) % cPages; 1294 if (RT_LIKELY(paPages[iPage2].HCPhys == HCPhys)) 1295 { 1296 iPage = iPage2; 1297 STAM_COUNTER_INC(&pVM->pgm.s.StatR0DynMapPageHit1); 1298 } 1299 else 1295 1300 { 1296 1301 iPage2 = (iPage + 2) % cPages; 1297 if (paPages[iPage2].HCPhys != HCPhys) 1302 if (paPages[iPage2].HCPhys == HCPhys) 1303 { 1304 iPage = iPage2; 1305 STAM_COUNTER_INC(&pVM->pgm.s.StatR0DynMapPageHit2); 1306 } 1307 else 1298 1308 { 1299 1309 iPage2 = (iPage + 3) % cPages; 1300 if (paPages[iPage2].HCPhys != HCPhys)1310 if (paPages[iPage2].HCPhys == HCPhys) 1301 1311 { 1302 iPage2 = (iPage + 4) % cPages; 1303 if (paPages[iPage2].HCPhys != HCPhys) 1304 { 1305 iPage = pgmR0DynMapPageSlow(pThis, HCPhys, iPage, pVM); 1306 if (RT_UNLIKELY(iPage == UINT32_MAX)) 1307 { 1308 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 1309 return iPage; 1310 } 1311 } 1312 else 1313 iPage = iPage2; 1312 iPage = iPage2; 1313 STAM_COUNTER_INC(&pVM->pgm.s.StatR0DynMapPageHit3); 1314 1314 } 1315 1315 else 1316 iPage = iPage2; 1317 } 1318 else 1319 iPage = iPage2; 1320 } 1321 else 1322 iPage = iPage2; 1316 { 1317 iPage = pgmR0DynMapPageSlow(pThis, HCPhys, iPage, pVM); 1318 if (RT_UNLIKELY(iPage == UINT32_MAX)) 1319 { 1320 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 1321 return iPage; 1322 } 1323 } 1324 } 1325 } 1323 1326 } 1324 1327 … … 1347 1350 RTCPUID idRealCpu = RTMpCpuId(); 1348 1351 bool fInvalidateIt = RTCpuSetIsMember(&paPages[iPage].PendingSet, idRealCpu); 1349 if ( fInvalidateIt)1352 if (RT_UNLIKELY(fInvalidateIt)) 1350 1353 RTCpuSetDel(&paPages[iPage].PendingSet, idRealCpu); 1351 1354 … … 1355 1358 * Do the actual invalidation outside the spinlock. 1356 1359 */ 1357 if ( fInvalidateIt)1360 if (RT_UNLIKELY(fInvalidateIt)) 1358 1361 { 1359 1362 STAM_COUNTER_INC(&pVM->pgm.s.StatR0DynMapPageInvlPg); … … 1709 1712 pSet->aEntries[i - 4].cRefs++; 1710 1713 /* Don't bother searching unless we're above a 75% load. */ 1711 else if ( i <= (int32_t)RT_ELEMENTS(pSet->aEntries) / 4 * 3)1714 else if (RT_LIKELY(i <= (int32_t)RT_ELEMENTS(pSet->aEntries) / 4 * 3)) 1712 1715 { 1713 1716 pSet->aEntries[pSet->cEntries].cRefs = 1;
Note:
See TracChangeset
for help on using the changeset viewer.