VirtualBox

Changeset 104859 in vbox for trunk/src


Ignore:
Timestamp:
Jun 5, 2024 8:33:10 PM (8 months ago)
Author:
vboxsync
Message:

VMM/PGM: Moved the apRamRangesTlbR0 out of the shared PGM structure and into the ring-0 only one; double the RAM range TLB size (from 8 to 16 entries). bugref:10687 bugref:10093

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

Legend:

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

    r104848 r104859  
    589589{
    590590    PGM_LOCK_VOID(pVM);
    591     RT_ZERO(pVM->pgm.s.apRamRangesTlbR3);
    592     RT_ZERO(pVM->pgm.s.apRamRangesTlbR0);
     591    /* This is technically only required when freeing the PCNet MMIO2 range
     592       during ancient saved state loading.  The code freeing the RAM range
     593       will make sure this function is called in both rings. */
     594    RT_ZERO(pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb);
    593595    PGM_UNLOCK(pVM);
    594596}
     
    630632            PPGMRAMRANGE const pRamRange  = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRanges[idRamRange];
    631633            Assert(pRamRange);
    632             pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
     634            pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
    633635            return pRamRange;
    634636        }
     
    677679            PPGMRAMRANGE const pRamRange  = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRanges[idRamRange];
    678680            Assert(pRamRange);
    679             pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
     681            pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
    680682            return pRamRange;
    681683        }
     
    731733            PPGMRAMRANGE const pRamRange  = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRanges[idRamRange];
    732734            AssertReturn(pRamRange, NULL);
    733             pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
     735            pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
    734736
    735737            /* Get the page. */
     
    784786            PPGMRAMRANGE const pRamRange  = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRanges[idRamRange];
    785787            AssertReturn(pRamRange, VERR_PGM_PHYS_RAM_LOOKUP_IPE);
    786             pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
     788            pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
    787789
    788790            /* Get the page. */
     
    840842            PPGMRAMRANGE const pRamRange  = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRanges[idRamRange];
    841843            AssertReturn(pRamRange, VERR_PGM_PHYS_RAM_LOOKUP_IPE);
    842             pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
     844            pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)] = pRamRange;
    843845
    844846            /* Get the page. */
     
    11031105    }
    11041106
     1107    /*
     1108     * Make sure the RAM range TLB does not contain any stale pointers to this range.
     1109     */
     1110    pgmPhysInvalidRamRangeTlbs(pVM);
    11051111    return rc;
    11061112}
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r104855 r104859  
    28522852
    28532853    pgmPhysInvalidatePageMapTLB(pVM);
    2854     pgmPhysInvalidRamRangeTlbs(pVM);
     2854    /*pgmPhysInvalidRamRangeTlbs(pVM); - not necessary */
    28552855
    28562856    return rc;
     
    34033403                                     rc2, idx, cChunks, pszDesc),
    34043404                                    rc = RT_SUCCESS(rc) ? rc2 : rc);
     3405                pgmPhysInvalidRamRangeTlbs(pVM); /* Ensure no stale pointers in the ring-3 RAM range TLB. */
    34053406            }
    34063407            if (RT_FAILURE(rc2))
     
    39053906
    39063907    pgmPhysInvalidatePageMapTLB(pVM);
    3907     pgmPhysInvalidRamRangeTlbs(pVM);
     3908    /* pgmPhysInvalidRamRangeTlbs(pVM); - not necessary */
    39083909
    39093910    return rcRet;
  • trunk/src/VBox/VMM/include/PGMInline.h

    r103374 r104859  
    7171DECLINLINE(PPGMRAMRANGE) pgmPhysGetRange(PVMCC pVM, RTGCPHYS GCPhys)
    7272{
    73     PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)];
     73    PPGMRAMRANGE pRam = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)];
    7474    if (!pRam || GCPhys - pRam->GCPhys >= pRam->cb)
    7575        return pgmPhysGetRangeSlow(pVM, GCPhys);
     
    9191DECLINLINE(PPGMRAMRANGE) pgmPhysGetRangeAtOrAbove(PVMCC pVM, RTGCPHYS GCPhys)
    9292{
    93     PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)];
     93    PPGMRAMRANGE pRam = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)];
    9494    if (   !pRam
    9595        || (GCPhys - pRam->GCPhys) >= pRam->cb)
     
    111111DECLINLINE(PPGMPAGE) pgmPhysGetPage(PVMCC pVM, RTGCPHYS GCPhys)
    112112{
    113     PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)];
     113    PPGMRAMRANGE pRam = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)];
    114114    RTGCPHYS off;
    115115    if (   pRam
     
    138138DECLINLINE(int) pgmPhysGetPageEx(PVMCC pVM, RTGCPHYS GCPhys, PPPGMPAGE ppPage)
    139139{
    140     PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)];
     140    PPGMRAMRANGE pRam = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)];
    141141    RTGCPHYS off;
    142142    if (   !pRam
     
    171171        ||  RT_UNLIKELY((off = GCPhys - pRam->GCPhys) >= pRam->cb))
    172172    {
    173         pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)];
     173        pRam = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)];
    174174        if (   !pRam
    175175            || (off = GCPhys - pRam->GCPhys) >= pRam->cb)
     
    197197DECLINLINE(int) pgmPhysGetPageAndRangeEx(PVMCC pVM, RTGCPHYS GCPhys, PPPGMPAGE ppPage, PPGMRAMRANGE *ppRam)
    198198{
    199     PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(apRamRangesTlb)[PGM_RAMRANGE_TLB_IDX(GCPhys)];
     199    PPGMRAMRANGE pRam = pVM->CTX_EXPR(pgm, pgmr0, pgm).s.apRamRangesTlb[PGM_RAMRANGE_TLB_IDX(GCPhys)];
    200200    RTGCPHYS off;
    201201    if (   !pRam
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r104840 r104859  
    14131413/** The number of entries in the RAM range TLBs (there is one for each
    14141414 *  context).  Must be a power of two. */
    1415 #define PGM_RAMRANGE_TLB_ENTRIES            8
     1415#define PGM_RAMRANGE_TLB_ENTRIES            16
    14161416
    14171417/**
     
    31123112
    31133113    /** RAM range TLB for R3. */
    3114     R3PTRTYPE(PPGMRAMRANGE)         apRamRangesTlbR3[PGM_RAMRANGE_TLB_ENTRIES];
     3114    R3PTRTYPE(PPGMRAMRANGE)         apRamRangesTlb[PGM_RAMRANGE_TLB_ENTRIES];
    31153115    /** Shadow Page Pool - R3 Ptr. */
    31163116    R3PTRTYPE(PPGMPOOL)             pPoolR3;
    3117     /** Pointer to the list of ROM ranges - for R3.
    3118      * This is sorted by physical address and contains no overlapping ranges. */
    3119     R3PTRTYPE(PPGMROMRANGE)         pRomRangesR3;
    3120 
    3121     /** RAM range TLB for R0. */
    3122     R0PTRTYPE(PPGMRAMRANGE)         apRamRangesTlbR0[PGM_RAMRANGE_TLB_ENTRIES];
     3117
    31233118    /** Shadow Page Pool - R0 Ptr. */
    31243119    R0PTRTYPE(PPGMPOOL)             pPoolR0;
    3125     /** R0 pointer corresponding to PGM::pRomRangesR3. */
    3126     R0PTRTYPE(PPGMROMRANGE)         pRomRangesR0;
    31273120
    31283121    /** Hack: Number of deprecated page mapping locks taken by the current lock
     
    31463139    uint32_t                        idxLastPhysHandler;
    31473140
    3148     uint32_t                        au64Padding3[5];
     3141    uint32_t                        au64Padding3[9];
    31493142
    31503143    /** PGM critical section.
     
    37633756    uint32_t                        idRamRangeMax;
    37643757    uint8_t                         abAlignment1[64 - sizeof(uint32_t)];
     3758    /** RAM range TLB for R0. */
     3759    R0PTRTYPE(PPGMRAMRANGE)         apRamRangesTlb[PGM_RAMRANGE_TLB_ENTRIES];
    37653760    /** @} */
    37663761
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