VirtualBox

Changeset 23088 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Sep 17, 2009 11:48:27 AM (15 years ago)
Author:
vboxsync
Message:

Reversed order of dirty page initialization as it was incorrect for SMP guests.

File:
1 edited

Legend:

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

    r23067 r23088  
    13571357            &&  pPage->iMonitoredPrev == NIL_PGMPOOL_IDX)
    13581358        {
     1359            pgmPoolAddDirtyPage(pVM, pPool, pPage);
     1360
    13591361            /* Temporarily allow write access to the page table again. */
    13601362            rc = PGMHandlerPhysicalPageTempOff(pVM, pPage->GCPhys, pPage->GCPhys);
     
    13681370                        ("PGMShwModifyPage -> GCPtr=%RGv rc=%d\n", pvFault, rc));
    13691371
    1370                 pgmPoolAddDirtyPage(pVM, pPool, pPage);
    13711372                pPage->pvDirtyFault = pvFault;
    13721373
     
    15041505        if (pShwPT->a[i].n.u1Present)
    15051506        {
    1506             /* The the old cached PTE is identical, then there's no need to flush the shadow copy. */
     1507            /* If the old cached PTE is identical, then there's no need to flush the shadow copy. */
    15071508            if ((pGstPT->a[i].u & X86_PTE_PAE_PG_MASK) == (pOldGstPT->a[i].u & X86_PTE_PAE_PG_MASK))
    15081509            {
     
    15591560    Log(("Flush dirty page %RGp cMods=%d\n", pPage->GCPhys, pPage->cModifications));
    15601561
    1561     /* Flush those PTEs that have changed. */
    1562     STAM_PROFILE_START(&pPool->StatTrackDeref,a);
    1563     void *pvShw = PGMPOOL_PAGE_2_LOCKED_PTR(pPool->CTX_SUFF(pVM), pPage);
    1564     void *pvGst;
    1565     bool  fFlush;
    1566     int rc = PGM_GCPHYS_2_PTR(pPool->CTX_SUFF(pVM), pPage->GCPhys, &pvGst); AssertReleaseRC(rc);
    1567     unsigned cChanges = pgmPoolTrackFlushPTPaePae(pPool, pPage, (PX86PTPAE)pvShw, (PCX86PTPAE)pvGst, (PCX86PTPAE)&pPool->aDirtyPages[idxSlot][0], fAllowRemoval, &fFlush);
    1568     STAM_PROFILE_STOP(&pPool->StatTrackDeref,a);
    1569 
    1570     /** Note: we might want to consider keeping the dirty page active in case there were many changes. */
    1571     if (fFlush)
    1572     {
    1573         Assert(fAllowRemoval);
    1574         Log(("Flush reused page table!\n"));
    1575         pgmPoolFlushPage(pPool, pPage);
    1576         STAM_COUNTER_INC(&pPool->StatForceFlushReused);
    1577         return;
    1578     }
    1579 
    1580     /* Write protect the page again to catch all write accesses. */
    1581     rc = PGMHandlerPhysicalReset(pVM, pPage->GCPhys);
     1562    /* First write protect the page again to catch all write accesses. (before checking for changes -> SMP) */
     1563    int rc = PGMHandlerPhysicalReset(pVM, pPage->GCPhys);
    15821564    Assert(rc == VINF_SUCCESS);
    15831565    pPage->fDirty = false;
     
    15941576              ("PGMShwGetPage -> GCPtr=%RGv rc=%d flags=%RX64\n", pPage->pvDirtyFault, rc, fFlags));
    15951577#endif
     1578
     1579    /* Flush those PTEs that have changed. */
     1580    STAM_PROFILE_START(&pPool->StatTrackDeref,a);
     1581    void *pvShw = PGMPOOL_PAGE_2_LOCKED_PTR(pPool->CTX_SUFF(pVM), pPage);
     1582    void *pvGst;
     1583    bool  fFlush;
     1584    rc = PGM_GCPHYS_2_PTR(pPool->CTX_SUFF(pVM), pPage->GCPhys, &pvGst); AssertReleaseRC(rc);
     1585    unsigned cChanges = pgmPoolTrackFlushPTPaePae(pPool, pPage, (PX86PTPAE)pvShw, (PCX86PTPAE)pvGst, (PCX86PTPAE)&pPool->aDirtyPages[idxSlot][0], fAllowRemoval, &fFlush);
     1586    STAM_PROFILE_STOP(&pPool->StatTrackDeref,a);
     1587
     1588    /** Note: we might want to consider keeping the dirty page active in case there were many changes. */
     1589    if (fFlush)
     1590    {
     1591        Assert(fAllowRemoval);
     1592        Log(("Flush reused page table!\n"));
     1593        pgmPoolFlushPage(pPool, pPage);
     1594        STAM_COUNTER_INC(&pPool->StatForceFlushReused);
     1595        return;
     1596    }
    15961597
    15971598    /* This page is likely to be modified again, so reduce the nr of modifications just a bit here. */
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