VirtualBox

Changeset 23488 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Oct 1, 2009 3:38:06 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53113
Message:

PGM: Lock stats and check for write locks on monitored pages during live save.

Location:
trunk/src/VBox/VMM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGM.cpp

    r23393 r23488  
    15701570    STAM_REL_REG(pVM, &pPGM->cMonitoredPages,               STAMTYPE_U32,     "/PGM/Page/cMonitoredPages",          STAMUNIT_OCCURENCES,     "The number of write monitored pages.");
    15711571    STAM_REL_REG(pVM, &pPGM->cWrittenToPages,               STAMTYPE_U32,     "/PGM/Page/cWrittenToPages",          STAMUNIT_OCCURENCES,     "The number of previously write monitored pages that have been written to.");
     1572    STAM_REL_REG(pVM, &pPGM->cWriteLockedPages,             STAMTYPE_U32,     "/PGM/Page/cWriteLockedPages",        STAMUNIT_OCCURENCES,     "The number of write(/read) locked pages.");
     1573    STAM_REL_REG(pVM, &pPGM->cReadLockedPages,              STAMTYPE_U32,     "/PGM/Page/cReadLockedPages",         STAMUNIT_OCCURENCES,     "The number of read (only) locked pages.");
    15721574    STAM_REL_REG(pVM, &pPGM->cHandyPages,                   STAMTYPE_U32,     "/PGM/Page/cHandyPages",              STAMUNIT_OCCURENCES,     "The number of handy pages (not included in cAllPages).");
    15731575    STAM_REL_REG(pVM, &pPGM->cRelocations,                  STAMTYPE_COUNTER, "/PGM/cRelocations",                  STAMUNIT_OCCURENCES,     "Number of hypervisor relocations.");
  • trunk/src/VBox/VMM/PGMInternal.h

    r23486 r23488  
    27042704    uint32_t                        cMonitoredPages;    /**< The number of write monitored pages. */
    27052705    uint32_t                        cWrittenToPages;    /**< The number of previously write monitored pages. */
     2706    uint32_t                        cWriteLockedPages;  /**< The number of write locked pages. */
     2707    uint32_t                        cReadLockedPages;   /**< The number of read locked pages. */
    27062708
    27072709    /** The number of times we were forced to change the hypervisor region location. */
  • trunk/src/VBox/VMM/PGMPhys.cpp

    r23478 r23488  
    456456            unsigned cLocks = PGM_PAGE_GET_WRITE_LOCKS(pPage);
    457457            if (RT_LIKELY(cLocks < PGM_PAGE_MAX_LOCKS - 1))
     458            {
     459                if (cLocks == 0)
     460                    pVM->pgm.s.cWriteLockedPages++;
    458461                PGM_PAGE_INC_WRITE_LOCKS(pPage);
     462            }
    459463            else if (cLocks != PGM_PAGE_GET_WRITE_LOCKS(pPage))
    460464            {
     
    530534            unsigned cLocks = PGM_PAGE_GET_READ_LOCKS(pPage);
    531535            if (RT_LIKELY(cLocks < PGM_PAGE_MAX_LOCKS - 1))
     536            {
     537                if (cLocks == 0)
     538                    pVM->pgm.s.cReadLockedPages++;
    532539                PGM_PAGE_INC_READ_LOCKS(pPage);
     540            }
    533541            else if (cLocks != PGM_PAGE_GET_READ_LOCKS(pPage))
    534542            {
  • trunk/src/VBox/VMM/PGMSavedState.cpp

    r23456 r23488  
    10471047                         * A RAM page.
    10481048                         */
    1049 /** @todo Check for page locks (write) since these indicates that someone might
    1050  * be changing the page without owning the PGM lock.  This breaks assumptions
    1051  * elsewhere.
    1052  * (A quick fix is to mark the page written-to when releasing a write lock.) */
    10531049                        switch (PGM_PAGE_GET_STATE(&pCur->aPages[iPage]))
    10541050                        {
     
    10881084                            case PGM_PAGE_STATE_WRITE_MONITORED:
    10891085                                Assert(paLSPages[iPage].fWriteMonitored);
    1090                                 paLSPages[iPage].fWriteMonitoredJustNow = 0;
     1086                                paLSPages[iPage].fWriteMonitoredJustNow = PGM_PAGE_GET_WRITE_LOCKS(&pCur->aPages[iPage]) > 0;
    10911087                                break;
    10921088
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r23471 r23488  
    10721072            unsigned cLocks = PGM_PAGE_GET_WRITE_LOCKS(pPage);
    10731073            if (RT_LIKELY(cLocks < PGM_PAGE_MAX_LOCKS - 1))
     1074            {
     1075                if (cLocks == 0)
     1076                    pVM->pgm.s.cWriteLockedPages++;
    10741077                PGM_PAGE_INC_WRITE_LOCKS(pPage);
     1078            }
    10751079            else if (cLocks != PGM_PAGE_GET_WRITE_LOCKS(pPage))
    10761080            {
     
    11701174            unsigned cLocks = PGM_PAGE_GET_READ_LOCKS(pPage);
    11711175            if (RT_LIKELY(cLocks < PGM_PAGE_MAX_LOCKS - 1))
     1176            {
     1177                if (cLocks == 0)
     1178                    pVM->pgm.s.cReadLockedPages++;
    11721179                PGM_PAGE_INC_READ_LOCKS(pPage);
     1180            }
    11731181            else if (cLocks != PGM_PAGE_GET_READ_LOCKS(pPage))
    11741182            {
     
    12931301        Assert(cLocks > 0);
    12941302        if (RT_LIKELY(cLocks > 0 && cLocks < PGM_PAGE_MAX_LOCKS))
     1303        {
     1304            if (cLocks == 1)
     1305            {
     1306                Assert(pVM->pgm.s.cWriteLockedPages > 0);
     1307                pVM->pgm.s.cWriteLockedPages--;
     1308            }
    12951309            PGM_PAGE_DEC_WRITE_LOCKS(pPage);
     1310        }
    12961311
    12971312        if (PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_WRITE_MONITORED)
     
    13091324        Assert(cLocks > 0);
    13101325        if (RT_LIKELY(cLocks > 0 && cLocks < PGM_PAGE_MAX_LOCKS))
     1326        {
     1327            if (cLocks == 1)
     1328            {
     1329                Assert(pVM->pgm.s.cReadLockedPages > 0);
     1330                pVM->pgm.s.cReadLockedPages--;
     1331            }
    13111332            PGM_PAGE_DEC_READ_LOCKS(pPage);
     1333        }
    13121334    }
    13131335
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette