VirtualBox

Changeset 14757

Show
Ignore:
Timestamp:
11/28/08 04:24:01 (1 month ago)
Author:
vboxsync
Message:

#3202: do PGMDynMapReleaseAutoSet/PGMDynMapStartAutoSet in the VMXR0RunGuestCode loop or we'll run out of entries very quickly (xp/pgmpool).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r14679 r14757  
    18941894    } 
    18951895#endif 
     1896#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 
     1897    PGMDynMapReleaseAutoSet(pVCpu); 
     1898#endif 
    18961899 
    18971900    /* 
     
    20482051        AssertRC(rc); 
    20492052    } 
     2053#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 
     2054    PGMDynMapStartAutoSet(pVCpu); 
     2055#endif 
    20502056 
    20512057    /* Some cases don't need a complete resync of the guest CPU state; handle them here. */ 
  • trunk/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp

    r14752 r14757  
    14681468 * since the PGMDynMapStartAutoSet call. 
    14691469 * 
     1470 * If the set is already closed, nothing will be done. 
     1471 * 
    14701472 * @param   pVCpu       The shared data for the current virtual CPU. 
    14711473 */ 
     
    14741476    PPGMMAPSET  pSet = &pVCpu->pgm.s.AutoSet; 
    14751477 
    1476     /* close the set */ 
     1478    /* 
     1479     * Is the set open? 
     1480     * 
     1481     * We might be closed before VM execution and not reopened again before 
     1482     * we leave for ring-3 or something. 
     1483     */ 
    14771484    uint32_t    i = pSet->cEntries; 
    1478     AssertMsg(i <= RT_ELEMENTS(pSet->aEntries), ("%#x (%u)\n", i, i)); 
    1479     pSet->cEntries = PGMMAPSET_CLOSED; 
    1480  
    1481     /* release any pages we're referencing. */ 
    1482     if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pSet->aEntries))) 
    1483     { 
    1484         PPGMR0DYNMAP    pThis = g_pPGMR0DynMap; 
    1485         RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER; 
    1486         RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 
    1487  
    1488         while (i-- > 0) 
    1489         { 
    1490             uint32_t iPage = pSet->aEntries[i].iPage; 
    1491             Assert(iPage < pThis->cPages); 
    1492             int32_t  cRefs = pSet->aEntries[i].cRefs; 
    1493             Assert(cRefs > 0); 
    1494             pgmR0DynMapReleasePageLocked(pThis, iPage, cRefs); 
    1495  
    1496             pSet->aEntries[i].iPage = UINT16_MAX; 
    1497             pSet->aEntries[i].cRefs = 0; 
    1498         } 
    1499  
    1500         Assert(pThis->cLoad <= pThis->cPages - pThis->cGuardPages); 
    1501         RTSpinlockRelease(pThis->hSpinlock, &Tmp); 
     1485    if (i != PGMMAPSET_CLOSED) 
     1486    { 
     1487        /* 
     1488         * Close the set 
     1489         */ 
     1490        AssertMsg(i <= RT_ELEMENTS(pSet->aEntries), ("%#x (%u)\n", i, i)); 
     1491        pSet->cEntries = PGMMAPSET_CLOSED; 
     1492 
     1493        /* 
     1494         * Release any pages it's referencing. 
     1495         */ 
     1496        if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pSet->aEntries))) 
     1497        { 
     1498            PPGMR0DYNMAP    pThis = g_pPGMR0DynMap; 
     1499            RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER; 
     1500            RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 
     1501 
     1502            while (i-- > 0) 
     1503            { 
     1504                uint32_t iPage = pSet->aEntries[i].iPage; 
     1505                Assert(iPage < pThis->cPages); 
     1506                int32_t  cRefs = pSet->aEntries[i].cRefs; 
     1507                Assert(cRefs > 0); 
     1508                pgmR0DynMapReleasePageLocked(pThis, iPage, cRefs); 
     1509 
     1510                pSet->aEntries[i].iPage = UINT16_MAX; 
     1511                pSet->aEntries[i].cRefs = 0; 
     1512            } 
     1513 
     1514            Assert(pThis->cLoad <= pThis->cPages - pThis->cGuardPages); 
     1515            RTSpinlockRelease(pThis->hSpinlock, &Tmp); 
     1516        } 
    15021517    } 
    15031518} 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy