VirtualBox

Changeset 92391 in vbox


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

VMM/PGM,GMM: Made pgmR0PhysAllocateHandyPages & GMMR0AllocateHandyPages callable from ring-0 HM context, eliminating the need for the call-ring-3 fun. bugref:10093

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/vmm.h

    r92368 r92391  
    5757    /** Signal a ring 0 assertion. */
    5858    VMMCALLRING3_VM_R0_ASSERTION,
    59 
    60     /** Allocates more handy pages. */
    61     VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES,
    6259    /** The usual 32-bit hack. */
    6360    VMMCALLRING3_32BIT_HACK = 0x7fffffff
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r92371 r92391  
    759759            int rc = PGMR3PhysAllocateHandyPages(pVM);
    760760#else
    761             int rc = VMMRZCallRing3NoCpu(pVM, VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES, 0);
     761            int rc = pgmR0PhysAllocateHandyPages(pVM, VMMGetCpuId(pVM), false /*fRing3*/);
    762762#endif
    763763            if (RT_UNLIKELY(rc != VINF_SUCCESS))
     
    798798    return VINF_SUCCESS;
    799799}
    800 
    801800
    802801
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r92368 r92391  
    29422942
    29432943    /*
    2944      * Validate, get basics and take the semaphore.
     2944     * Validate & get basics.
    29452945     * (This is a relatively busy path, so make predictions where possible.)
    29462946     */
     
    29832983    }
    29842984
    2985     gmmR0MutexAcquire(pGMM);
    2986     if (GMM_CHECK_SANITY_UPON_ENTERING(pGMM))
     2985    /*
     2986     * Take the semaphore
     2987     */
     2988    VMMR0EMTBLOCKCTX Ctx;
     2989    PGVMCPU          pGVCpu = &pGVM->aCpus[idCpu];
     2990    rc = VMMR0EmtPrepareToBlock(pGVCpu, VINF_SUCCESS, "GMMR0AllocateHandyPages", pGMM, &Ctx);
     2991    AssertRCReturn(rc, rc);
     2992
     2993    rc = gmmR0MutexAcquire(pGMM);
     2994    if (   RT_SUCCESS(rc)
     2995        && GMM_CHECK_SANITY_UPON_ENTERING(pGMM))
    29872996    {
    29882997        /* No allocations before the initial reservation has been made! */
     
    31053114            rc = VERR_WRONG_ORDER;
    31063115        GMM_CHECK_SANITY_UPON_LEAVING(pGMM);
    3107     }
    3108     else
     3116        gmmR0MutexRelease(pGMM);
     3117    }
     3118    else if (RT_SUCCESS(rc))
     3119    {
     3120        gmmR0MutexRelease(pGMM);
    31093121        rc = VERR_GMM_IS_NOT_SANE;
    3110     gmmR0MutexRelease(pGMM);
     3122    }
     3123    VMMR0EmtResumeAfterBlocking(pGVCpu, &Ctx);
     3124
    31113125    LogFlow(("GMMR0AllocateHandyPages: returns %Rrc\n", rc));
    31123126    return rc;
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r92368 r92391  
    12941294            switch (pVCpu->vmm.s.enmCallRing3Operation)
    12951295            {
    1296                 case VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES:
    1297                     STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMAllocHandy);
    1298                     break;
    12991296                case VMMCALLRING3_VM_R0_ASSERTION:
    13001297                default:
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r92390 r92391  
    58155815
    58165816/**
    5817  * Response to VM_FF_PGM_NEED_HANDY_PAGES and VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES.
     5817 * Response to VM_FF_PGM_NEED_HANDY_PAGES and helper for pgmPhysEnsureHandyPage.
    58185818 *
    58195819 * This function will also work the VM_FF_PGM_NO_MEMORY force action flag, to
    5820  * signal and clear the out of memory condition. When contracted, this API is
    5821  * used to try clear the condition when the user wants to resume.
     5820 * signal and clear the out of memory condition.  When called, this API is used
     5821 * to try clear the condition when the user wants to resume.
    58225822 *
    58235823 * @returns The following VBox status codes.
  • trunk/src/VBox/VMM/VMMR3/VMM.cpp

    r92368 r92391  
    430430    STAM_REG(pVM, &pVM->vmm.s.StatRZRetPatchTPR,            STAMTYPE_COUNTER, "/VMM/RZRet/PatchTPR",            STAMUNIT_OCCURENCES, "Number of VINF_EM_HM_PATCH_TPR_INSTR returns.");
    431431    STAM_REG(pVM, &pVM->vmm.s.StatRZRetCallRing3,           STAMTYPE_COUNTER, "/VMM/RZCallR3/Misc",             STAMUNIT_OCCURENCES, "Number of Other ring-3 calls.");
    432     STAM_REG(pVM, &pVM->vmm.s.StatRZCallPGMAllocHandy,      STAMTYPE_COUNTER, "/VMM/RZCallR3/PGMAllocHandy",    STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES calls.");
    433432
    434433    STAMR3Register(pVM, &pVM->vmm.s.StatLogFlusherFlushes,  STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, "/VMM/LogFlush/00-Flushes",  STAMUNIT_OCCURENCES, "Total number of buffer flushes");
     
    25002499    {
    25012500        /*
    2502          * Allocates more handy pages.
    2503          */
    2504         case VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES:
    2505         {
    2506             pVCpu->vmm.s.rcCallRing3 = PGMR3PhysAllocateHandyPages(pVM);
    2507             break;
    2508         }
    2509 
    2510         /*
    25112501         * Signal a ring 0 hypervisor assertion.
    25122502         * Cancel the longjmp operation that's in progress.
     
    25312521            return VERR_VMM_UNKNOWN_RING3_CALL;
    25322522    }
    2533 
    2534     pVCpu->vmm.s.enmCallRing3Operation = VMMCALLRING3_INVALID;
    2535     return VINF_SUCCESS;
    25362523}
    25372524
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r92385 r92391  
    38123812int             pgmPhysAllocLargePage(PVMCC pVM, RTGCPHYS GCPhys);
    38133813#ifdef IN_RING0
     3814int             pgmR0PhysAllocateHandyPages(PGVM pGVM, VMCPUID idCpu, bool fRing3);
    38143815int             pgmR0PhysAllocateLargePage(PGVM pGVM, VMCPUID idCpu, RTGCPHYS GCPhys);
    38153816#endif
  • trunk/src/VBox/VMM/include/VMMInternal.h

    r91245 r92391  
    414414    STAMCOUNTER                 StatRZRetPGMFlushPending;
    415415    STAMCOUNTER                 StatRZRetPatchTPR;
    416     STAMCOUNTER                 StatRZCallPGMAllocHandy;
    417416    /** @} */
    418417} VMM;
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