VirtualBox

Changeset 31657 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 13, 2010 2:53:34 PM (14 years ago)
Author:
vboxsync
Message:

PGMPool: Drop cRefs since it's always 1.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGMInternal.h

    r31606 r31657  
    23412341 *
    23422342 * @returns The @a cRefs field
    2343  * @param   u16         The tracking data word. */
     2343 * @param   u16         The tracking data word.
     2344 * @remarks This will only return 1 or PGMPOOL_TD_CREFS_PHYSEXT for a
     2345 *          non-zero @a u16. */
    23442346#define PGMPOOL_TD_GET_CREFS(u16)       ( ((u16) >> PGMPOOL_TD_CREFS_SHIFT) & PGMPOOL_TD_CREFS_MASK )
    23452347
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r31636 r31657  
    14121412{
    14131413    PVM pVM = pVCpu->CTX_SUFF(pVM);
     1414
    14141415    /*
    14151416     * Just deal with the simple first time here.
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r31636 r31657  
    29482948
    29492949/**
    2950  * Scans one shadow page table for mappings of a physical page.
    2951  *
    2952  * @returns true/false indicating removal of all relevant PTEs
     2950 * Checks one shadow page table entry for a mapping of a physical page.
     2951 *
     2952 * @returns true / false indicating removal of all relevant PTEs
     2953 *
    29532954 * @param   pVM         The VM handle.
    29542955 * @param   pPhysPage   The guest page in question.
     
    29562957 * @param   iShw        The shadow page table.
    29572958 * @param   iPte        Page table entry or NIL_PGMPOOL_PHYSEXT_IDX_PTE if unknown
    2958  * @param   cRefs       The number of references made in that PT.
    2959  */
    2960 static bool pgmPoolTrackFlushGCPhysPTInt(PVM pVM, PCPGMPAGE pPhysPage, bool fFlushPTEs, uint16_t iShw, uint16_t iPte, uint16_t cRefs)
    2961 {
    2962     LogFlow(("pgmPoolTrackFlushGCPhysPT: pPhysPage=%RHp iShw=%d iPte=%d cRefs=%d\n", PGM_PAGE_GET_HCPHYS(pPhysPage), iShw, iPte, cRefs));
     2959 */
     2960static bool pgmPoolTrackFlushGCPhysPTInt(PVM pVM, PCPGMPAGE pPhysPage, bool fFlushPTEs, uint16_t iShw, uint16_t iPte)
     2961{
     2962    LogFlow(("pgmPoolTrackFlushGCPhysPTInt: pPhysPage=%RHp iShw=%d iPte=%d\n", PGM_PAGE_GET_HCPHYS(pPhysPage), iShw, iPte));
    29632963    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    29642964    bool     fRet  = false;
     
    29672967     * Assert sanity.
    29682968     */
    2969     Assert(cRefs == 1);
    29702969    Assert(iPte != NIL_PGMPOOL_PHYSEXT_IDX_PTE);
    29712970    AssertFatalMsg(iShw < pPool->cCurPages && iShw != NIL_PGMPOOL_IDX, ("iShw=%d\n", iShw));
     
    30153014            if (!u32AndMask)
    30163015            {
    3017                 Assert(pPage->cPresent >= cRefs);
    3018                 Assert(pPool->cPresent >= cRefs);
    3019                 pPage->cPresent -= cRefs;
    3020                 pPool->cPresent -= cRefs;
     3016                Assert(pPage->cPresent );
     3017                Assert(pPool->cPresent);
     3018                pPage->cPresent--;
     3019                pPool->cPresent--;
    30213020            }
    30223021
     
    30253024                X86PTE Pte;
    30263025
    3027                 Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pte=%RX32 cRefs=%#x\n", iPte, pPT->a[iPte], cRefs));
     3026                Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pte=%RX32\n", iPte, pPT->a[iPte]));
    30283027                Pte.u = (pPT->a[iPte].u & u32AndMask) | u32OrMask;
    30293028                if (Pte.u & PGM_PTFLAGS_TRACK_DIRTY)
     
    30353034            }
    30363035#ifdef LOG_ENABLED
    3037             Log(("cRefs=%d iFirstPresent=%d cPresent=%d\n", cRefs, pPage->iFirstPresent, pPage->cPresent));
    3038             for (unsigned i = 0; i < RT_ELEMENTS(pPT->a); i++)
     3036            Log(("iFirstPresent=%d cPresent=%d\n", pPage->iFirstPresent, pPage->cPresent));
     3037            for (unsigned i = 0, cFound = 0; i < RT_ELEMENTS(pPT->a); i++)
    30393038                if ((pPT->a[i].u & (X86_PTE_PG_MASK | X86_PTE_P)) == u32)
    30403039                {
    3041                     Log(("i=%d cRefs=%d\n", i, cRefs--));
     3040                    Log(("i=%d cFound=%d\n", i, ++cFound));
    30423041                }
    30433042#endif
    3044             AssertFatalMsgFailed(("cRefs=%d iFirstPresent=%d cPresent=%d u32=%RX32 poolkind=%x\n", cRefs, pPage->iFirstPresent, pPage->cPresent, u32, pPage->enmKind));
     3043            AssertFatalMsgFailed(("iFirstPresent=%d cPresent=%d u32=%RX32 poolkind=%x\n", pPage->iFirstPresent, pPage->cPresent, u32, pPage->enmKind));
    30453044            PGM_DYNMAP_UNUSED_HINT_VM(pVM, pPT);
    30463045            break;
     
    30893088            if (!u64AndMask)
    30903089            {
    3091                 Assert(pPage->cPresent >= cRefs);
    3092                 Assert(pPool->cPresent >= cRefs);
    3093                 pPage->cPresent -= cRefs;
    3094                 pPool->cPresent -= cRefs;
     3090                Assert(pPage->cPresent);
     3091                Assert(pPool->cPresent);
     3092                pPage->cPresent--;
     3093                pPool->cPresent--;
    30953094            }
    30963095
     
    30993098                X86PTEPAE Pte;
    31003099
    3101                 Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pte=%RX64 cRefs=%#x\n", iPte, pPT->a[iPte], cRefs));
     3100                Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pte=%RX64\n", iPte, pPT->a[iPte]));
    31023101                Pte.u = (pPT->a[iPte].u & u64AndMask) | u64OrMask;
    31033102                if (Pte.u & PGM_PTFLAGS_TRACK_DIRTY)
     
    31093108            }
    31103109#ifdef LOG_ENABLED
    3111             Log(("cRefs=%d iFirstPresent=%d cPresent=%d\n", cRefs, pPage->iFirstPresent, pPage->cPresent));
     3110            Log(("iFirstPresent=%d cPresent=%d\n", pPage->iFirstPresent, pPage->cPresent));
    31123111            Log(("Found %RX64 expected %RX64\n", pPT->a[iPte].u & (X86_PTE_PAE_PG_MASK | X86_PTE_P), u64));
    3113             for (unsigned i = 0; i < RT_ELEMENTS(pPT->a); i++)
     3112            for (unsigned i = 0, cFound = 0; i < RT_ELEMENTS(pPT->a); i++)
    31143113                if ((pPT->a[i].u & (X86_PTE_PAE_PG_MASK | X86_PTE_P | X86_PTE_PAE_MBZ_MASK_NX)) == u64)
    3115                 {
    3116                     Log(("i=%d cRefs=%d\n", i, cRefs--));
    3117                 }
     3114                    Log(("i=%d cFound=%d\n", i, ++cFound));
    31183115#endif
    3119             AssertFatalMsgFailed(("cRefs=%d iFirstPresent=%d cPresent=%d u64=%RX64 poolkind=%x\n", cRefs, pPage->iFirstPresent, pPage->cPresent, u64, pPage->enmKind));
     3116            AssertFatalMsgFailed(("iFirstPresent=%d cPresent=%d u64=%RX64 poolkind=%x\n", pPage->iFirstPresent, pPage->cPresent, u64, pPage->enmKind));
    31203117            PGM_DYNMAP_UNUSED_HINT_VM(pVM, pPT);
    31213118            break;
     
    31333130            if ((pPD->a[iPte].u & (EPT_PDE2M_PG_MASK | X86_PDE4M_P | X86_PDE4M_PS)) == u64)
    31343131            {
    3135                 Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pde=%RX64 cRefs=%#x\n", iPte, pPD->a[iPte], cRefs));
     3132                Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pde=%RX64\n", iPte, pPD->a[iPte]));
    31363133                STAM_COUNTER_INC(&pPool->StatTrackFlushEntry);
    31373134                pPD->a[iPte].u = 0;
     
    31473144            }
    31483145# ifdef LOG_ENABLED
    3149             Log(("cRefs=%d iFirstPresent=%d cPresent=%d\n", cRefs, pPage->iFirstPresent, pPage->cPresent));
    3150             for (unsigned i = 0; i < RT_ELEMENTS(pPD->a); i++)
     3146            Log(("iFirstPresent=%d cPresent=%d\n", pPage->iFirstPresent, pPage->cPresent));
     3147            for (unsigned i = 0, cFound = 0; i < RT_ELEMENTS(pPD->a); i++)
    31513148                if ((pPD->a[i].u & (EPT_PDE2M_PG_MASK | X86_PDE4M_P | X86_PDE4M_PS)) == u64)
    3152                 {
    3153                     Log(("i=%d cRefs=%d\n", i, cRefs--));
    3154                 }
     3149                    Log(("i=%d cFound=%d\n", i, ++cFound));
    31553150# endif
    3156             AssertFatalMsgFailed(("cRefs=%d iFirstPresent=%d cPresent=%d\n", cRefs, pPage->iFirstPresent, pPage->cPresent));
     3151            AssertFatalMsgFailed(("iFirstPresent=%d cPresent=%d\n", pPage->iFirstPresent, pPage->cPresent));
    31573152            PGM_DYNMAP_UNUSED_HINT_VM(pVM, pPD);
    31583153            break;
     
    31693164            if ((pPD->a[iPte].u & (X86_PDE2M_PAE_PG_MASK | X86_PDE4M_P | X86_PDE4M_PS)) == u64)
    31703165            {
    3171                 Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pde=%RX64 cRefs=%#x\n", iPte, pPD->a[iPte], cRefs));
     3166                Log4(("pgmPoolTrackFlushGCPhysPTs: i=%d pde=%RX64\n", iPte, pPD->a[iPte]));
    31723167                STAM_COUNTER_INC(&pPool->StatTrackFlushEntry);
    31733168                pPD->a[iPte].u = 0;
     
    31823177            }
    31833178# ifdef LOG_ENABLED
    3184             Log(("cRefs=%d iFirstPresent=%d cPresent=%d\n", cRefs, pPage->iFirstPresent, pPage->cPresent));
    3185             for (unsigned i = 0; i < RT_ELEMENTS(pPD->a); i++)
     3179            Log(("iFirstPresent=%d cPresent=%d\n", pPage->iFirstPresent, pPage->cPresent));
     3180            for (unsigned i = 0, cFound = 0; i < RT_ELEMENTS(pPD->a); i++)
    31863181                if ((pPD->a[i].u & (X86_PDE2M_PAE_PG_MASK | X86_PDE4M_P | X86_PDE4M_PS)) == u64)
    3187                 {
    3188                     Log(("i=%d cRefs=%d\n", i, cRefs--));
    3189                 }
     3182                    Log(("i=%d cFound=%d\n", i, ++cFound));
    31903183# endif
    3191             AssertFatalMsgFailed(("cRefs=%d iFirstPresent=%d cPresent=%d\n", cRefs, pPage->iFirstPresent, pPage->cPresent));
     3184            AssertFatalMsgFailed(("iFirstPresent=%d cPresent=%d\n", pPage->iFirstPresent, pPage->cPresent));
    31923185            PGM_DYNMAP_UNUSED_HINT_VM(pVM, pPD);
    31933186            break;
     
    32093202 * @param   fFlushPTEs  Flush PTEs or allow them to be updated (e.g. in case of an RW bit change)
    32103203 * @param   iShw        The shadow page table.
    3211  * @param   cRefs       The number of references made in that PT.
    3212  */
    3213 static void pgmPoolTrackFlushGCPhysPT(PVM pVM, PPGMPAGE pPhysPage, bool fFlushPTEs, uint16_t iShw, uint16_t cRefs)
     3204 */
     3205static void pgmPoolTrackFlushGCPhysPT(PVM pVM, PPGMPAGE pPhysPage, bool fFlushPTEs, uint16_t iShw)
    32143206{
    32153207    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); NOREF(pPool);
     
    32173209    /* We should only come here with when there's only one reference to this physical page. */
    32183210    Assert(PGMPOOL_TD_GET_CREFS(PGM_PAGE_GET_TRACKING(pPhysPage)) == 1);
    3219     Assert(cRefs == 1);
    3220 
    3221     Log2(("pgmPoolTrackFlushGCPhysPT: pPhysPage=%RHp iShw=%d cRefs=%d\n", PGM_PAGE_GET_HCPHYS(pPhysPage), iShw, cRefs));
     3211
     3212    Log2(("pgmPoolTrackFlushGCPhysPT: pPhysPage=%RHp iShw=%d\n", PGM_PAGE_GET_HCPHYS(pPhysPage), iShw));
    32223213    STAM_PROFILE_START(&pPool->StatTrackFlushGCPhysPT, f);
    3223     bool fKeptPTEs = pgmPoolTrackFlushGCPhysPTInt(pVM, pPhysPage, fFlushPTEs, iShw, PGM_PAGE_GET_PTE_INDEX(pPhysPage), cRefs);
     3214    bool fKeptPTEs = pgmPoolTrackFlushGCPhysPTInt(pVM, pPhysPage, fFlushPTEs, iShw, PGM_PAGE_GET_PTE_INDEX(pPhysPage));
    32243215    if (!fKeptPTEs)
    32253216        PGM_PAGE_SET_TRACKING(pPhysPage, 0);
     
    32553246            if (pPhysExt->aidx[i] != NIL_PGMPOOL_IDX)
    32563247            {
    3257                 bool fKeptPTEs = pgmPoolTrackFlushGCPhysPTInt(pVM, pPhysPage, fFlushPTEs, pPhysExt->aidx[i], pPhysExt->apte[i], 1);
     3248                bool fKeptPTEs = pgmPoolTrackFlushGCPhysPTInt(pVM, pPhysPage, fFlushPTEs, pPhysExt->aidx[i], pPhysExt->apte[i]);
    32583249                if (!fKeptPTEs)
    32593250                {
     
    33653356
    33663357            if (PGMPOOL_TD_GET_CREFS(u16) != PGMPOOL_TD_CREFS_PHYSEXT)
     3358            {
     3359                Assert(PGMPOOL_TD_GET_CREFS(u16) == 1);
    33673360                pgmPoolTrackFlushGCPhysPT(pVM,
    33683361                                          pPhysPage,
    33693362                                          fFlushPTEs,
    3370                                           PGMPOOL_TD_GET_IDX(u16),
    3371                                           PGMPOOL_TD_GET_CREFS(u16));
     3363                                          PGMPOOL_TD_GET_IDX(u16));
     3364            }
    33723365            else if (u16 != PGMPOOL_TD_MAKE(PGMPOOL_TD_CREFS_PHYSEXT, PGMPOOL_TD_IDX_OVERFLOWED))
    33733366                pgmPoolTrackFlushGCPhysPTs(pVM, pPhysPage, fFlushPTEs, PGMPOOL_TD_GET_IDX(u16));
     
    39023895    return u16;
    39033896}
     3897
    39043898
    39053899/**
Note: See TracChangeset for help on using the changeset viewer.

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