VirtualBox

Changeset 26685 in vbox for trunk


Ignore:
Timestamp:
Feb 22, 2010 5:48:23 PM (15 years ago)
Author:
vboxsync
Message:

Large page changes

Location:
trunk
Files:
7 edited

Legend:

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

    r26616 r26685  
    283283    (    (enmProt) == PGMROMPROT_READ_ROM_WRITE_IGNORE \
    284284      || (enmProt) == PGMROMPROT_READ_ROM_WRITE_RAM )
     285
     286
    285287
    286288VMMDECL(bool)       PGMIsLocked(PVM pVM);
     
    405407
    406408
     409VMMDECL(void) PGMSetLargePageUsage(PVM pVM, bool fUseLargePages);
     410
     411/**
     412 * Query large page usage state
     413 *
     414 * @returns 0 - disabled, 1 - enabled
     415 * @param   pVM         The VM to operate on.
     416 */
     417#define PGMIsUsingLargePages(pVM) (pVM->fUseLargePages)
     418
     419
    407420#ifdef IN_RC
    408421/** @defgroup grp_pgm_gc  The PGM Guest Context API
  • trunk/include/VBox/vm.h

    r26066 r26685  
    784784    /** PARAV enabled flag. */
    785785    bool                        fPARAVEnabled;
     786    /** Large page enabled flag. */
     787    bool                        fUseLargePages;
    786788    /** @} */
    787789
  • trunk/src/VBox/VMM/HWACCM.cpp

    r26176 r26685  
    11571157                    if (pVM->hwaccm.s.vmx.fUnrestrictedGuest)
    11581158                        LogRel(("HWACCM: Unrestricted guest execution enabled!\n"));
     1159
     1160#ifdef DEBUG_sandervl
     1161                    /* Use large (2 MB) pages for our EPT PDEs where possible. */
     1162                    PGMSetLargePageUsage(pVM, true);
     1163#endif
    11591164                }
    11601165                else
  • trunk/src/VBox/VMM/VMMAll/HWACCMAll.cpp

    r26152 r26685  
    338338    return !!pVCpu->hwaccm.s.Event.fPending;
    339339}
    340 
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r26277 r26685  
    21082108
    21092109/**
     2110 * Enable or disable large page usage
     2111 *
     2112 * @param   pVM             The VM to operate on.
     2113 * @param   fUseLargePages  Use/not use large pages
     2114 */
     2115VMMDECL(void) PGMSetLargePageUsage(PVM pVM, bool fUseLargePages)
     2116{
     2117      pVM->fUseLargePages = fUseLargePages;
     2118}
     2119
     2120/**
    21102121 * Acquire the PGM lock.
    21112122 *
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r26635 r26685  
    29372937    Assert(!PdeDst.n.u1Present); /* We're only supposed to call SyncPT on PDE!P and conflicts.*/
    29382938
    2939 # if (PGM_SHW_TYPE == PGM_TYPE_EPT) && (HC_ARCH_BITS == 64) && defined(RT_OS_WINDOWS) && defined(DEBUG_sandervl)
     2939# if (PGM_SHW_TYPE == PGM_TYPE_EPT) && (HC_ARCH_BITS == 64) && defined(RT_OS_WINDOWS)
     2940    if (PGMIsUsingLargePages(pVM))
    29402941    {
    29412942        RTHCPHYS HCPhys;
    29422943        rc = pgmPhysAllocLargePage(pVM, GCPtrPage & SHW_PDE_PG_MASK, &HCPhys);
    29432944        if (RT_SUCCESS(rc))
    2944         {   
     2945        {
    29452946            PdeDst.u &= X86_PDE_AVL_MASK;
    29462947            PdeDst.u |= HCPhys;
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r26679 r26685  
    368368    Assert(!PGM_PAGE_IS_MMIO(pPage));
    369369
     370    if (PGMIsUsingLargePages(pVM))
     371    {
     372        RTHCPHYS HCPhysDummy;
     373
     374        int rc = pgmPhysAllocLargePage(pVM, GCPhys, &HCPhysDummy);
     375        if (rc == VINF_SUCCESS)
     376            return rc;
     377
     378        /* fall back to 4kb pages. */
     379    }
    370380
    371381    /*
     
    471481     */
    472482    Assert(PGMIsLocked(pVM));
     483    Assert(PGMIsUsingLargePages(pVM));
    473484    Assert((GCPhys & X86_PD_PAE_MASK) == 0);
    474485    AssertPtr(pHCPhys);
     
    540551                }
    541552                LogFlow(("pgmPhysAllocLargePage failed with %Rrc\n", rc));
     553
     554                /* If we fail once, it most likely means the host's memory is too fragmented; don't bother trying again. */
     555                PGMSetLargePageUsage(pVM, false);
    542556                return rc;
    543557            }
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