VirtualBox

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


Ignore:
Timestamp:
Sep 15, 2021 11:29:42 AM (3 years ago)
Author:
vboxsync
Message:

VMM/PGM: Some cleanups around large page allocation... bugref:10093

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r91014 r91246  
    947947             */
    948948# ifdef IN_RING3
    949             rc = PGMR3PhysAllocateLargeHandyPage(pVM, GCPhysBase);
     949            rc = PGMR3PhysAllocateLargePage(pVM, GCPhysBase);
    950950# else
    951951            rc = VMMRZCallRing3NoCpu(pVM, VMMCALLRING3_PGM_ALLOCATE_LARGE_HANDY_PAGE, GCPhysBase);
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r91016 r91246  
    13101310    PGMSTATS *pStats = pVM->pgm.s.pStatsR3;
    13111311
    1312     PGM_REG_PROFILE(&pStats->StatAllocLargePage,                "/PGM/LargePage/Prof/Alloc",          "Time spent by the host OS for large page allocation.");
    1313     PGM_REG_PROFILE(&pStats->StatClearLargePage,                "/PGM/LargePage/Prof/Clear",          "Time spent clearing the newly allocated large pages.");
     1312    PGM_REG_PROFILE(&pStats->StatAllocLargePage,                "/PGM/LargePage/Alloc",               "Time spent by the host OS for large page allocation.");
     1313    PGM_REG_PROFILE(&pStats->StatClearLargePage,                "/PGM/LargePage/Clear",               "Time spent clearing the newly allocated large pages.");
    13141314    PGM_REG_COUNTER(&pStats->StatLargePageOverflow,             "/PGM/LargePage/Overflow",            "The number of times allocating a large page took too long.");
    1315     PGM_REG_PROFILE(&pStats->StatR3IsValidLargePage,            "/PGM/LargePage/Prof/R3/IsValid",     "pgmPhysIsValidLargePage profiling - R3.");
    1316     PGM_REG_PROFILE(&pStats->StatRZIsValidLargePage,            "/PGM/LargePage/Prof/RZ/IsValid",     "pgmPhysIsValidLargePage profiling - RZ.");
     1315    PGM_REG_PROFILE(&pStats->StatR3IsValidLargePage,            "/PGM/LargePage/IsValidR3",           "pgmPhysIsValidLargePage profiling - R3.");
     1316    PGM_REG_PROFILE(&pStats->StatRZIsValidLargePage,            "/PGM/LargePage/IsValidRZ",           "pgmPhysIsValidLargePage profiling - RZ.");
    13171317
    13181318    PGM_REG_COUNTER(&pStats->StatR3DetectedConflicts,           "/PGM/R3/DetectedConflicts",          "The number of times PGMR3CheckMappingConflicts() detected a conflict.");
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r91245 r91246  
    49304930 * @param   GCPhys      GC physical start address of the 2 MB range
    49314931 */
    4932 VMMR3DECL(int) PGMR3PhysAllocateLargeHandyPage(PVM pVM, RTGCPHYS GCPhys)
     4932VMMR3_INT_DECL(int) PGMR3PhysAllocateLargePage(PVM pVM, RTGCPHYS GCPhys)
    49334933{
    49344934#ifdef PGM_WITH_LARGE_PAGES
    4935     uint64_t u64TimeStamp1, u64TimeStamp2;
    4936 
    49374935    PGM_LOCK_VOID(pVM);
    49384936
    49394937    STAM_PROFILE_START(&pVM->pgm.s.CTX_SUFF(pStats)->StatAllocLargePage, a);
    4940     u64TimeStamp1 = RTTimeMilliTS();
     4938    uint64_t const msAllocStart = RTTimeMilliTS();
    49414939    int rc = VMMR3CallR0(pVM, VMMR0_DO_PGM_ALLOCATE_LARGE_HANDY_PAGE, 0, NULL);
    4942     u64TimeStamp2 = RTTimeMilliTS();
     4940    uint64_t const cMsElapsed   = RTTimeMilliTS() - msAllocStart;
    49434941    STAM_PROFILE_STOP(&pVM->pgm.s.CTX_SUFF(pStats)->StatAllocLargePage, a);
    49444942    if (RT_SUCCESS(rc))
     
    50125010    {
    50135011        static uint32_t cTimeOut = 0;
    5014         uint64_t u64TimeStampDelta = u64TimeStamp2 - u64TimeStamp1;
    5015 
    5016         if (u64TimeStampDelta > 100)
     5012        if (cMsElapsed > 100)
    50175013        {
    50185014            STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->StatLargePageOverflow);
    5019             if (    ++cTimeOut > 10
    5020                 ||  u64TimeStampDelta > 1000 /* more than one second forces an early retirement from allocating large pages. */)
     5015            if (   ++cTimeOut > 10
     5016                || cMsElapsed > 1000 /* more than one second forces an early retirement from allocating large pages. */)
    50215017            {
    50225018                /* If repeated attempts to allocate a large page takes more than 100 ms, then we fall back to normal 4k pages.
    50235019                 * E.g. Vista 64 tries to move memory around, which takes a huge amount of time.
    50245020                 */
    5025                 LogRel(("PGMR3PhysAllocateLargePage: allocating large pages takes too long (last attempt %d ms; nr of timeouts %d); DISABLE\n", u64TimeStampDelta, cTimeOut));
     5021                LogRel(("PGMR3PhysAllocateLargePage: allocating large pages takes too long (last attempt %RU64 ms; nr of timeouts %d); DISABLE\n", cMsElapsed, cTimeOut));
    50265022                PGMSetLargePageUsage(pVM, false);
    50275023            }
    50285024        }
    5029         else
    5030         if (cTimeOut > 0)
     5025        else if (cTimeOut > 0)
    50315026            cTimeOut--;
    50325027    }
  • trunk/src/VBox/VMM/VMMR3/VMM.cpp

    r91245 r91246  
    25132513        case VMMCALLRING3_PGM_ALLOCATE_LARGE_HANDY_PAGE:
    25142514        {
    2515             pVCpu->vmm.s.rcCallRing3 = PGMR3PhysAllocateLargeHandyPage(pVM, pVCpu->vmm.s.u64CallRing3Arg);
     2515            pVCpu->vmm.s.rcCallRing3 = PGMR3PhysAllocateLargePage(pVM, pVCpu->vmm.s.u64CallRing3Arg);
    25162516            break;
    25172517        }
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