VirtualBox

Changeset 92389 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Nov 12, 2021 8:53:46 AM (3 years ago)
Author:
vboxsync
Message:

VMM/PGM: PGMR0PhysAllocateHandyPages should no longer need to deal with quota issues as we reserve RAM + handy pages. bugref:10093

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r92385 r92389  
    151151     * Check for error injection.
    152152     */
    153     if (RT_UNLIKELY(pGVM->pgm.s.fErrInjHandyPages))
     153    if (RT_LIKELY(!pGVM->pgm.s.fErrInjHandyPages))
     154    { /* likely */ }
     155    else
    154156        return VERR_NO_MEMORY;
    155157
     
    180182    else
    181183    {
    182         if (    (   rc == VERR_GMM_HIT_GLOBAL_LIMIT
    183                  || rc == VERR_GMM_HIT_VM_ACCOUNT_LIMIT)
    184             &&  iFirst < PGM_HANDY_PAGES_MIN)
    185         {
    186 
    187 #ifdef VBOX_STRICT
    188             /* We're ASSUMING that GMM has updated all the entires before failing us. */
    189             uint32_t i;
    190             for (i = iFirst; i < RT_ELEMENTS(pGVM->pgm.s.aHandyPages); i++)
    191             {
    192                 Assert(pGVM->pgm.s.aHandyPages[i].idPage       == NIL_GMM_PAGEID);
    193                 Assert(pGVM->pgm.s.aHandyPages[i].idSharedPage == NIL_GMM_PAGEID);
    194                 Assert(pGVM->pgm.s.aHandyPages[i].HCPhysGCPhys == NIL_GMMPAGEDESC_PHYS);
    195                 Assert(pGVM->pgm.s.aHandyPages[i].fZeroed      == false);
    196             }
    197 #endif
    198 
    199             /*
    200              * Reduce the number of pages until we hit the minimum limit.
    201              */
    202             do
    203             {
    204                 cPages >>= 1;
    205                 if (cPages + iFirst < PGM_HANDY_PAGES_MIN)
    206                     cPages = PGM_HANDY_PAGES_MIN - iFirst;
    207                 rc = GMMR0AllocateHandyPages(pGVM, idCpu, 0, cPages, &pGVM->pgm.s.aHandyPages[iFirst]);
    208             } while (   (   rc == VERR_GMM_HIT_GLOBAL_LIMIT
    209                          || rc == VERR_GMM_HIT_VM_ACCOUNT_LIMIT)
    210                      && cPages + iFirst > PGM_HANDY_PAGES_MIN);
    211             if (RT_SUCCESS(rc))
    212             {
    213 #ifdef VBOX_STRICT
    214                 i = iFirst + cPages;
    215                 while (i-- > 0)
    216                 {
    217                     Assert(pGVM->pgm.s.aHandyPages[i].idPage != NIL_GMM_PAGEID);
    218                     Assert(pGVM->pgm.s.aHandyPages[i].idPage <= GMM_PAGEID_LAST);
    219                     Assert(pGVM->pgm.s.aHandyPages[i].idSharedPage == NIL_GMM_PAGEID);
    220                     Assert(pGVM->pgm.s.aHandyPages[i].HCPhysGCPhys != NIL_GMMPAGEDESC_PHYS);
    221                     Assert(!(pGVM->pgm.s.aHandyPages[i].HCPhysGCPhys & ~X86_PTE_PAE_PG_MASK));
    222                 }
    223 
    224                 for (i = cPages + iFirst; i < RT_ELEMENTS(pGVM->pgm.s.aHandyPages); i++)
    225                 {
    226                     Assert(pGVM->pgm.s.aHandyPages[i].idPage       == NIL_GMM_PAGEID);
    227                     Assert(pGVM->pgm.s.aHandyPages[i].idSharedPage == NIL_GMM_PAGEID);
    228                     Assert(pGVM->pgm.s.aHandyPages[i].HCPhysGCPhys == NIL_GMMPAGEDESC_PHYS);
    229                     Assert(pGVM->pgm.s.aHandyPages[i].fZeroed      == false);
    230                 }
    231 #endif
    232 
    233                 pGVM->pgm.s.cHandyPages = iFirst + cPages;
    234             }
    235         }
    236 
    237         if (RT_FAILURE(rc))
    238         {
    239             LogRel(("PGMR0PhysAllocateHandyPages: rc=%Rrc iFirst=%d cPages=%d\n", rc, iFirst, cPages));
    240             VM_FF_SET(pGVM, VM_FF_PGM_NO_MEMORY);
    241         }
     184        LogRel(("PGMR0PhysAllocateHandyPages: rc=%Rrc iFirst=%d cPages=%d\n", rc, iFirst, cPages));
     185        VM_FF_SET(pGVM, VM_FF_PGM_NO_MEMORY);
    242186    }
    243187
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