Changeset 23534 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Oct 3, 2009 9:54:08 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53177
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMInternal.h
r23518 r23534 2712 2712 struct 2713 2713 { 2714 /** The number of ready pages. */ 2715 uint32_t cReadyPages; 2716 /** The number of dirty pages. */ 2717 uint32_t cDirtyPages; 2714 /** Per type statistics. */ 2715 struct 2716 { 2717 /** The number of ready pages. */ 2718 uint32_t cReadyPages; 2719 /** The number of dirty pages. */ 2720 uint32_t cDirtyPages; 2721 } Rom, 2722 Mmio2, 2723 Ram; 2718 2724 /** The number of monitored pages. */ 2719 2725 uint32_t cMonitoredPages; 2720 2726 /** The number of ignored pages. */ 2721 2727 uint32_t cIgnoredPages; 2722 /** The number of dirty MMIO2 pages. */2723 uint32_t cDirtyMmio2Pages;2724 2728 /** Indicates that a live save operation is active. */ 2725 2729 bool fActive; 2726 2730 /** Padding. */ 2727 bool afReserved[ 3];2731 bool afReserved[4+3]; 2728 2732 } LiveSave; 2729 2733 -
trunk/src/VBox/VMM/PGMSavedState.cpp
r23532 r23534 215 215 } 216 216 217 pVM->pgm.s.LiveSave. cDirtyPages += cPages;217 pVM->pgm.s.LiveSave.Rom.cDirtyPages += cPages; 218 218 if (pRom->fFlags & PGMPHYS_ROM_FLAGS_SHADOWED) 219 pVM->pgm.s.LiveSave. cDirtyPages += cPages;219 pVM->pgm.s.LiveSave.Rom.cDirtyPages += cPages; 220 220 } 221 221 pgmUnlock(pVM); … … 356 356 { 357 357 pRomPage->LiveSave.fDirty = true; 358 pVM->pgm.s.LiveSave. cReadyPages--;359 pVM->pgm.s.LiveSave. cDirtyPages++;358 pVM->pgm.s.LiveSave.Rom.cReadyPages--; 359 pVM->pgm.s.LiveSave.Rom.cDirtyPages++; 360 360 } 361 361 pRomPage->LiveSave.fDirtiedRecently = true; … … 433 433 if (fLiveSave) 434 434 { 435 pVM->pgm.s.LiveSave. cDirtyPages--;436 pVM->pgm.s.LiveSave. cReadyPages++;435 pVM->pgm.s.LiveSave.Rom.cDirtyPages--; 436 pVM->pgm.s.LiveSave.Rom.cReadyPages++; 437 437 } 438 438 } … … 498 498 pRomPage->LiveSave.u8Prot = (uint8_t)enmProt; 499 499 pRomPage->LiveSave.fDirty = false; 500 pVM->pgm.s.LiveSave. cReadyPages++;501 pVM->pgm.s.LiveSave. cDirtyPages--;500 pVM->pgm.s.LiveSave.Rom.cReadyPages++; 501 pVM->pgm.s.LiveSave.Rom.cDirtyPages--; 502 502 } 503 503 pgmUnlock(pVM); … … 598 598 pgmLock(pVM); 599 599 pMmio2->paLSPages = paLSPages; 600 pVM->pgm.s.LiveSave. cDirtyMmio2Pages += cPages;600 pVM->pgm.s.LiveSave.Mmio2.cDirtyPages += cPages; 601 601 } 602 602 pgmUnlock(pVM); … … 767 767 { 768 768 pLSPage->fDirty = true; 769 pVM->pgm.s.LiveSave. cReadyPages--;770 pVM->pgm.s.LiveSave. cDirtyMmio2Pages++;769 pVM->pgm.s.LiveSave.Mmio2.cReadyPages--; 770 pVM->pgm.s.LiveSave.Mmio2.cDirtyPages++; 771 771 } 772 772 return true; … … 783 783 { 784 784 /* 785 * Only do this every 4th time as it's a little bit expensive. 786 */ 787 if ( (uPass & 3) != 0 785 * Since this is a bit expensive we lower the scan rate after a little while. 786 */ 787 if ( ( (uPass & 3) != 0 788 && uPass > 10) 788 789 || uPass == SSM_PASS_FINAL) 789 790 return; … … 879 880 } 880 881 /* 881 * Only do this every 4rd time since it's kind of expense. 882 * Reduce the rate after a little while since the current MMIO2 approach is 883 * a bit expensive. 882 884 * We position it two passes after the scan pass to avoid saving busy pages. 883 885 */ 884 else if ((uPass & 3) == 2) 886 else if ( uPass <= 10 887 || (uPass & 3) == 2) 885 888 { 886 889 pgmLock(pVM); … … 906 909 907 910 /* Save it. */ 908 if (!paLSPages[iPage].fZero) 909 RTSha1(pbPage, PAGE_SIZE, paLSPages[iPage].abSha1Saved); 911 bool const fZero = paLSPages[iPage].fZero; 912 uint8_t abPage[PAGE_SIZE]; 913 if (!fZero) 914 { 915 memcpy(abPage, pbPage, PAGE_SIZE); 916 RTSha1(abPage, PAGE_SIZE, paLSPages[iPage].abSha1Saved); 917 } 918 910 919 uint8_t u8Type = paLSPages[iPage].fZero ? PGM_STATE_REC_MMIO2_ZERO : PGM_STATE_REC_MMIO2_RAW; 911 920 if (iPage != 0 && iPage == iPageLast + 1) … … 918 927 } 919 928 if (u8Type == PGM_STATE_REC_MMIO2_RAW) 920 rc = SSMR3PutMem(pSSM, pbPage, PAGE_SIZE);929 rc = SSMR3PutMem(pSSM, abPage, PAGE_SIZE); 921 930 if (RT_FAILURE(rc)) 922 931 break; 932 933 /* Housekeeping. */ 934 paLSPages[iPage].fDirty = false; 935 pVM->pgm.s.LiveSave.Mmio2.cDirtyPages--; 936 pVM->pgm.s.LiveSave.Mmio2.cReadyPages++; 923 937 iPageLast = iPage; 924 938 } … … 1037 1051 } 1038 1052 paLSPages[iPage].fIgnore = 0; 1039 pVM->pgm.s.LiveSave. cDirtyPages++;1053 pVM->pgm.s.LiveSave.Ram.cDirtyPages++; 1040 1054 break; 1041 1055 … … 1147 1161 if (!paLSPages[iPage].fDirty) 1148 1162 { 1149 pVM->pgm.s.LiveSave. cReadyPages--;1150 pVM->pgm.s.LiveSave. cDirtyPages++;1163 pVM->pgm.s.LiveSave.Ram.cReadyPages--; 1164 pVM->pgm.s.LiveSave.Ram.cDirtyPages++; 1151 1165 if (++paLSPages[iPage].cDirtied > PGMLIVSAVEPAGE_MAX_DIRTIED) 1152 1166 paLSPages[iPage].cDirtied = PGMLIVSAVEPAGE_MAX_DIRTIED; … … 1171 1185 if (!paLSPages[iPage].fDirty) 1172 1186 { 1173 pVM->pgm.s.LiveSave. cReadyPages--;1174 pVM->pgm.s.LiveSave. cDirtyPages++;1187 pVM->pgm.s.LiveSave.Ram.cReadyPages--; 1188 pVM->pgm.s.LiveSave.Ram.cDirtyPages++; 1175 1189 if (++paLSPages[iPage].cDirtied > PGMLIVSAVEPAGE_MAX_DIRTIED) 1176 1190 paLSPages[iPage].cDirtied = PGMLIVSAVEPAGE_MAX_DIRTIED; … … 1187 1201 { 1188 1202 paLSPages[iPage].fDirty = 1; 1189 pVM->pgm.s.LiveSave. cReadyPages--;1190 pVM->pgm.s.LiveSave. cDirtyPages++;1203 pVM->pgm.s.LiveSave.Ram.cReadyPages--; 1204 pVM->pgm.s.LiveSave.Ram.cDirtyPages++; 1191 1205 } 1192 1206 } … … 1201 1215 { 1202 1216 paLSPages[iPage].fDirty = 1; 1203 pVM->pgm.s.LiveSave. cReadyPages--;1204 pVM->pgm.s.LiveSave. cDirtyPages++;1217 pVM->pgm.s.LiveSave.Ram.cReadyPages--; 1218 pVM->pgm.s.LiveSave.Ram.cDirtyPages++; 1205 1219 } 1206 1220 } … … 1237 1251 /** @todo the counting doesn't quite work out here. fix later? */ 1238 1252 if (paLSPages[iPage].fDirty) 1239 pVM->pgm.s.LiveSave. cDirtyPages--;1253 pVM->pgm.s.LiveSave.Ram.cDirtyPages--; 1240 1254 else 1241 pVM->pgm.s.LiveSave. cReadyPages--;1255 pVM->pgm.s.LiveSave.Ram.cReadyPages--; 1242 1256 pVM->pgm.s.LiveSave.cIgnoredPages++; 1243 1257 } … … 1383 1397 paLSPages[iPage].fDirty = 0; 1384 1398 paLSPages[iPage].uPassSaved = uPass; 1385 pVM->pgm.s.LiveSave. cReadyPages++;1386 pVM->pgm.s.LiveSave. cDirtyPages--;1399 pVM->pgm.s.LiveSave.Ram.cReadyPages++; 1400 pVM->pgm.s.LiveSave.Ram.cDirtyPages--; 1387 1401 } 1388 1402 if (idRamRangesGen != pVM->pgm.s.idRamRangesGen) … … 1536 1550 static DECLCALLBACK(int) pgmR3LiveVote(PVM pVM, PSSMHANDLE pSSM) 1537 1551 { 1538 // RTPrintf("# Ready=%08x Dirty=%#08x Ignored=%#08x Monitored=%#08x MMIO2=%#08x\n", 1539 // pVM->pgm.s.LiveSave.cReadyPages, 1540 // pVM->pgm.s.LiveSave.cDirtyPages, 1541 // pVM->pgm.s.LiveSave.cIgnoredPages, 1542 // pVM->pgm.s.LiveSave.cMonitoredPages, 1543 // pVM->pgm.s.LiveSave.cMmio2Pages 1544 // ); 1545 // static int s_iHack = 0; 1546 // if ((++s_iHack % 25) == 0) 1547 // return VINF_SUCCESS; 1548 1549 if (pVM->pgm.s.LiveSave.cDirtyPages < 256) /* semi random number. */ 1552 #if 0 1553 RTPrintf("# Ram R/D=%08x/%08x Ignored=%#08x Monitored=%#08x Rom R/D=%08x/%08x Mmio2 R/D=%08x/%08x\n", 1554 pVM->pgm.s.LiveSave.Ram.cReadyPages, 1555 pVM->pgm.s.LiveSave.Ram.cDirtyPages, 1556 pVM->pgm.s.LiveSave.cIgnoredPages, 1557 pVM->pgm.s.LiveSave.cMonitoredPages, 1558 pVM->pgm.s.LiveSave.Rom.cReadyPages, 1559 pVM->pgm.s.LiveSave.Rom.cDirtyPages, 1560 pVM->pgm.s.LiveSave.Mmio2.cReadyPages, 1561 pVM->pgm.s.LiveSave.Mmio2.cDirtyPages 1562 ); 1563 static int s_iHack = 0; 1564 if ((++s_iHack % 42) == 0) 1550 1565 return VINF_SUCCESS; 1566 #else 1567 if ( pVM->pgm.s.LiveSave.Rom.cDirtyPages 1568 + pVM->pgm.s.LiveSave.Mmio2.cDirtyPages 1569 + pVM->pgm.s.LiveSave.Ram.cDirtyPages 1570 < 256) /* semi random numbers. */ 1571 return VINF_SUCCESS; 1572 #endif 1551 1573 return VINF_SSM_VOTE_FOR_ANOTHER_PASS; 1552 1574 } … … 1645 1667 * Initialize the statistics. 1646 1668 */ 1647 pVM->pgm.s.LiveSave.cReadyPages = 0; 1648 pVM->pgm.s.LiveSave.cDirtyPages = 0; 1649 pVM->pgm.s.LiveSave.cIgnoredPages = 0; 1650 pVM->pgm.s.LiveSave.cDirtyMmio2Pages = 0; 1651 pVM->pgm.s.LiveSave.fActive = true; 1669 pVM->pgm.s.LiveSave.Rom.cReadyPages = 0; 1670 pVM->pgm.s.LiveSave.Rom.cDirtyPages = 0; 1671 pVM->pgm.s.LiveSave.Mmio2.cReadyPages = 0; 1672 pVM->pgm.s.LiveSave.Mmio2.cDirtyPages = 0; 1673 pVM->pgm.s.LiveSave.Ram.cReadyPages = 0; 1674 pVM->pgm.s.LiveSave.Ram.cDirtyPages = 0; 1675 pVM->pgm.s.LiveSave.cIgnoredPages = 0; 1676 pVM->pgm.s.LiveSave.fActive = true; 1652 1677 1653 1678 /*
Note:
See TracChangeset
for help on using the changeset viewer.