VirtualBox

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


Ignore:
Timestamp:
May 18, 2009 11:47:04 AM (16 years ago)
Author:
vboxsync
Message:

Fixed the stale TLB detection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r19777 r19778  
    21632163            pPdeSrc->b.u1Dirty = 1;
    21642164
    2165             if (    pPdeDst->n.u1Present
    2166                 && (pPdeDst->u & PGM_PDFLAGS_TRACK_DIRTY))
     2165            if (pPdeDst->n.u1Present)
    21672166            {
    2168                 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyPageTrap));
    2169                 Assert(pPdeSrc->b.u1Write);
    2170 
    2171                 /* Note: No need to invalidate this entry on other VCPUs as a stale TLB entry will not harm; write access will simply
    2172                  *       fault again and take this path to only invalidate the entry.
    2173                  */
    2174                 pPdeDst->n.u1Write      = 1;
    2175                 pPdeDst->n.u1Accessed   = 1;
    2176                 pPdeDst->au32[0]       &= ~PGM_PDFLAGS_TRACK_DIRTY;
    2177                 PGM_INVL_BIG_PG(GCPtrPage);
    2178                 STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a);
    2179                 return VINF_PGM_HANDLED_DIRTY_BIT_FAULT;
     2167                if (pPdeDst->u & PGM_PDFLAGS_TRACK_DIRTY)
     2168                {
     2169                    STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyPageTrap));
     2170                    Assert(pPdeSrc->b.u1Write);
     2171
     2172                    /* Note: No need to invalidate this entry on other VCPUs as a stale TLB entry will not harm; write access will simply
     2173                     *       fault again and take this path to only invalidate the entry.
     2174                     */
     2175                    pPdeDst->n.u1Write      = 1;
     2176                    pPdeDst->n.u1Accessed   = 1;
     2177                    pPdeDst->au32[0]       &= ~PGM_PDFLAGS_TRACK_DIRTY;
     2178                    PGM_INVL_BIG_PG(GCPtrPage);
     2179                    STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a);
     2180                    return VINF_PGM_HANDLED_DIRTY_BIT_FAULT;
     2181                }
     2182                else
     2183                /* Check for stale TLB entry; only applies to the SMP guest case. */
     2184                if (    pVM->cCPUs > 1
     2185                    &&  pPdeDst->n.u1Write
     2186                    &&  pPdeDst->n.u1Accessed)
     2187                {
     2188                    PPGMPOOLPAGE    pShwPage = pgmPoolGetPage(pPool, pPdeDst->u & SHW_PDE_PG_MASK);
     2189                    if (pShwPage)
     2190                    {
     2191                        PSHWPT      pPTDst   = (PSHWPT)PGMPOOL_PAGE_2_PTR(pVM, pShwPage);
     2192                        PSHWPTE     pPteDst  = &pPTDst->a[(GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK];
     2193                        if (    pPteDst->n.u1Present
     2194                            &&  pPteDst->n.u1Write)
     2195                        {
     2196                            /* Stale TLB entry. */
     2197                            STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyPageStale));
     2198                            PGM_INVL_PG(GCPtrPage);
     2199
     2200                            STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a);
     2201                            return VINF_PGM_HANDLED_DIRTY_BIT_FAULT;
     2202                        }
     2203                    }
     2204                }
    21802205            }
    21812206        }
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