VirtualBox

Changeset 92390 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Nov 12, 2021 9:24:33 AM (3 years ago)
Author:
vboxsync
Message:

VMM/PGM: Moved the zeroing and failure reporting from PGMR3PhysAllocateHandyPages and into PGMR0PhysAllocateHandyPages. bugref:10093

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r92368 r92390  
    58435843    AssertMsgReturn(iClear <= RT_ELEMENTS(pVM->pgm.s.aHandyPages), ("%d", iClear), VERR_PGM_HANDY_PAGE_IPE);
    58445844    Log(("PGMR3PhysAllocateHandyPages: %d -> %d\n", iClear, RT_ELEMENTS(pVM->pgm.s.aHandyPages)));
    5845     int rcAlloc = VINF_SUCCESS;
    5846     int rcSeed  = VINF_SUCCESS;
    58475845    int rc = VMMR3CallR0(pVM, VMMR0_DO_PGM_ALLOCATE_HANDY_PAGES, 0, NULL);
    58485846    /** @todo we should split this up into an allocate and flush operation. sometimes you want to flush and not allocate more (which will trigger the vm account limit error) */
     
    58585856        AssertMsg(rc == VINF_SUCCESS, ("%Rrc\n", rc));
    58595857        Assert(pVM->pgm.s.cHandyPages > 0);
    5860         VM_FF_CLEAR(pVM, VM_FF_PGM_NEED_HANDY_PAGES);
    5861         VM_FF_CLEAR(pVM, VM_FF_PGM_NO_MEMORY);
    5862 
    58635858#ifdef VBOX_STRICT
    58645859        uint32_t i;
     
    58815876        }
    58825877#endif
    5883         /*
    5884          * Clear the pages.
    5885          */
    5886         while (iClear < pVM->pgm.s.cHandyPages)
    5887         {
    5888             PGMMPAGEDESC pPage = &pVM->pgm.s.aHandyPages[iClear];
    5889             if (!pPage->fZeroed)
    5890             {
    5891                 void *pv;
    5892                 rc = pgmPhysPageMapByPageID(pVM, pPage->idPage, pPage->HCPhysGCPhys, &pv);
    5893                 AssertLogRelMsgBreak(RT_SUCCESS(rc),
    5894                                      ("%u/%u: idPage=%#x HCPhysGCPhys=%RHp rc=%Rrc\n",
    5895                                       iClear, pVM->pgm.s.cHandyPages, pPage->idPage, pPage->HCPhysGCPhys, rc));
    5896                 ASMMemZeroPage(pv);
    5897                 pPage->fZeroed = true;
    5898             }
    5899 #ifdef VBOX_STRICT
    5900             else
    5901             {
    5902                 void *pv;
    5903                 rc = pgmPhysPageMapByPageID(pVM, pPage->idPage, pPage->HCPhysGCPhys, &pv);
    5904                 AssertLogRelMsgBreak(RT_SUCCESS(rc),
    5905                                      ("%u/%u: idPage=%#x HCPhysGCPhys=%RHp rc=%Rrc\n",
    5906                                       iClear, pVM->pgm.s.cHandyPages, pPage->idPage, pPage->HCPhysGCPhys, rc));
    5907                 Assert(ASMMemIsZeroPage(pv));
    5908             }
    5909 #endif
    5910             iClear++;
    5911             Log3(("PGMR3PhysAllocateHandyPages: idPage=%#x HCPhys=%RGp\n", pPage->idPage, pPage->HCPhysGCPhys));
    5912         }
    59135878    }
    59145879    else
    59155880    {
    5916         uint64_t cAllocPages, cMaxPages, cBalloonPages;
    5917 
    59185881        /*
    59195882         * We should never get here unless there is a genuine shortage of
     
    59235886         */
    59245887        /* Report the failure. */
    5925         LogRel(("PGM: Failed to procure handy pages; rc=%Rrc rcAlloc=%Rrc rcSeed=%Rrc cHandyPages=%#x\n"
     5888        LogRel(("PGM: Failed to procure handy pages; rc=%Rrc cHandyPages=%#x\n"
    59265889                "     cAllPages=%#x cPrivatePages=%#x cSharedPages=%#x cZeroPages=%#x\n",
    5927                 rc, rcAlloc, rcSeed,
    5928                 pVM->pgm.s.cHandyPages,
    5929                 pVM->pgm.s.cAllPages,
    5930                 pVM->pgm.s.cPrivatePages,
    5931                 pVM->pgm.s.cSharedPages,
    5932                 pVM->pgm.s.cZeroPages));
    5933 
    5934         if (GMMR3QueryMemoryStats(pVM, &cAllocPages, &cMaxPages, &cBalloonPages) == VINF_SUCCESS)
    5935         {
    5936             LogRel(("GMM: Statistics:\n"
    5937                     "     Allocated pages: %RX64\n"
    5938                     "     Maximum   pages: %RX64\n"
    5939                     "     Ballooned pages: %RX64\n", cAllocPages, cMaxPages, cBalloonPages));
    5940         }
     5890                rc, pVM->pgm.s.cHandyPages,
     5891                pVM->pgm.s.cAllPages, pVM->pgm.s.cPrivatePages, pVM->pgm.s.cSharedPages, pVM->pgm.s.cZeroPages));
    59415892
    59425893        if (   rc != VERR_NO_MEMORY
    59435894            && rc != VERR_NO_PHYS_MEMORY
    59445895            && rc != VERR_LOCK_FAILED)
    5945         {
    59465896            for (uint32_t i = 0; i < RT_ELEMENTS(pVM->pgm.s.aHandyPages); i++)
    59475897            {
     
    59645914                }
    59655915            }
    5966         }
    59675916
    59685917        if (rc == VERR_NO_MEMORY)
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