VirtualBox

Changeset 18266 in vbox


Ignore:
Timestamp:
Mar 25, 2009 5:25:53 PM (16 years ago)
Author:
vboxsync
Message:

PGM: Made PGMR3PhysRomProtect use instead of doing a full pool flush for each call (expensive using reset), this fixes a reset assertion in pgmPoolMonitorFlush. Changed pgmPoolTrackFlushGCPhys to return VINF_PGM_SYNC_CR3 and set VM_FF_PGM_SYNCR3 and PGM_SYNC_CLEAR_PGM_POOL instead of leave this to the caller.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGMPhys.cpp

    r18230 r18266  
    23352335 *
    23362336 * @returns VBox status code.
     2337 * @retval  VINF_PGM_SYNC_CR3
     2338 *
    23372339 * @param   pVM         Pointer to the shared VM structure.
    23382340 * @param   GCPhys      Where to start. Page aligned.
     
    23562358     * Process the request.
    23572359     */
    2358     bool fFlushedPool = false;
     2360    int  rc = VINF_SUCCESS;
     2361    bool fFlushTLB = false;
    23592362    for (PPGMROMRANGE pRom = pVM->pgm.s.pRomRangesR3; pRom; pRom = pRom->pNextR3)
    23602363        if (    GCPhys     <= pRom->GCPhysLast
     
    23632366        {
    23642367            /*
    2365              * Iterate the relevant pages and the ncessary make changes.
     2368             * Iterate the relevant pages and make necessary the changes.
    23662369             */
    23672370            bool fChanges = false;
     
    23782381                    fChanges = true;
    23792382
    2380                     /* flush the page pool first so we don't leave any usage references dangling. */
    2381                     if (!fFlushedPool)
    2382                     {
    2383                         pgmPoolFlushAll(pVM);
    2384                         fFlushedPool = true;
    2385                     }
     2383                    /* flush references to the page. */
     2384                    PPGMPAGE pRamPage = pgmPhysGetPage(&pVM->pgm.s, pRom->GCPhys + (iPage << PAGE_SHIFT));
     2385                    int rc2 = pgmPoolTrackFlushGCPhys(pVM, pRamPage, &fFlushTLB);
     2386                    if (rc2 != VINF_SUCCESS && (rc == VINF_SUCCESS || RT_FAILURE(rc2)))
     2387                        rc = rc2;
    23862388
    23872389                    PPGMPAGE pOld = PGMROMPROT_IS_ROM(pRomPage->enmProt) ? &pRomPage->Virgin : &pRomPage->Shadow;
    23882390                    PPGMPAGE pNew = PGMROMPROT_IS_ROM(pRomPage->enmProt) ? &pRomPage->Shadow : &pRomPage->Virgin;
    2389                     PPGMPAGE pRamPage = pgmPhysGetPage(&pVM->pgm.s, pRom->GCPhys + (iPage << PAGE_SHIFT));
    23902391
    23912392                    *pOld = *pRamPage;
     
    24102411        }
    24112412
    2412     return VINF_SUCCESS;
     2413    if (fFlushTLB)
     2414        PGM_INVL_GUEST_TLBS();
     2415    return rc;
    24132416}
    24142417
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r18234 r18266  
    169169    {
    170170        rc = pgmHandlerPhysicalSetRamFlagsAndFlushShadowPTs(pVM, pNew, pRam);
    171         if (rc == VINF_PGM_GCPHYS_ALIASED)
    172         {
    173             pVM->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
    174             VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3);
    175         }
     171        if (rc == VINF_PGM_SYNC_CR3)
     172            rc = VINF_PGM_GCPHYS_ALIASED;
    176173        pVM->pgm.s.fPhysCacheFlushPending = true;
    177174        HWACCMFlushTLB(pVM);
     
    203200 * @returns VBox status code.
    204201 * @retval  VINF_SUCCESS when shadow PTs was successfully updated.
    205  * @retval  VINF_PGM_GCPHYS_ALIASED when the shadow PTs could be updated because
    206  *          the guest page aliased or/and mapped by multiple PTs.
     202 * @retval  VINF_PGM_SYNC_CR3 when the shadow PTs could be updated because
     203 *          the guest page aliased or/and mapped by multiple PTs. FFs set.
    207204 * @param   pVM     The VM handle.
    208205 * @param   pCur    The physical handler.
     
    441438    int rc = pgmPoolTrackFlushGCPhys(pVM, pPage, &fFlushTLBs);
    442439    AssertLogRelRCReturnVoid(rc);
    443     if (rc == VINF_PGM_GCPHYS_ALIASED)
    444     {
    445         pVM->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
    446         VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3);
    447         rc = VINF_PGM_SYNC_CR3;
    448     }
    449440# ifdef IN_RC
    450     else if (fFlushTLBs)
     441    if (fFlushTLBs && rc != VINF_PGM_SYNC_CR3)
    451442        PGM_INVL_GUEST_TLBS();
    452443# else
     
    580571                     */
    581572                    rc = pgmHandlerPhysicalSetRamFlagsAndFlushShadowPTs(pVM, pCur, pRam);
    582                     if (rc == VINF_PGM_GCPHYS_ALIASED)
    583                     {
    584                         pVM->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
    585                         VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3);
    586                     }
    587573                    pVM->pgm.s.fPhysCacheFlushPending = true;
    588574
     
    891877                     */
    892878                    rc = pgmHandlerPhysicalSetRamFlagsAndFlushShadowPTs(pVM, pCur, pRam);
    893                     if (rc == VINF_PGM_GCPHYS_ALIASED)
    894                     {
    895                         pVM->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
    896                         VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3);
    897                     }
    898879                    pVM->pgm.s.fPhysCacheFlushPending = true;
    899880                    HWACCMFlushTLB(pVM);
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r18230 r18266  
    382382    bool fFlushTLBs = false;
    383383    int rc = pgmPoolTrackFlushGCPhys(pVM, pPage, &fFlushTLBs);
    384     if (rc == VINF_SUCCESS)
    385         /* nothing */;
    386     else if (rc == VINF_PGM_GCPHYS_ALIASED)
    387     {
    388         pVM->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
    389         VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3);
    390         rc = VINF_PGM_SYNC_CR3;
    391     }
    392     else
    393     {
    394         AssertRCReturn(rc, rc);
    395         AssertMsgFailedReturn(("%Rrc\n", rc), VERR_INTERNAL_ERROR);
    396     }
     384    AssertMsgReturn(rc == VINF_SUCCESS || rc == VINF_PGM_GCPHYS_ALIASED, ("%Rrc\n", rc), RT_FAILURE(rc) ? rc : VERR_INTERNAL_ERROR);
    397385
    398386    /*
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r18215 r18266  
    26302630 * @returns VBox status code.
    26312631 * @retval  VINF_SUCCESS if all references has been successfully cleared.
    2632  * @retval  VINF_PGM_GCPHYS_ALIASED if we're better off with a CR3 sync and
    2633  *          a page pool cleaning.
     2632 * @retval  VINF_PGM_SYNC_CR3 if we're better off with a CR3 sync and a page
     2633 *          pool cleaning. FF and sync flags are set.
    26342634 *
    26352635 * @param   pVM         The VM handle.
     
    27062706    rc = VINF_PGM_GCPHYS_ALIASED;
    27072707#endif
     2708
     2709    if (rc == VINF_PGM_GCPHYS_ALIASED)
     2710    {
     2711        pVM->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
     2712        VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3);
     2713        rc = VINF_PGM_SYNC_CR3;
     2714    }
    27082715
    27092716    return rc;
     
    39543961    }
    39553962
    3956     /* Force a shadow mode reinit (necessary for nested paging and ept). */
     3963    /*
     3964     * Force a shadow mode reinit (necessary for nested paging and ept).
     3965     * Reinit the current shadow paging mode as well; nested paging and
     3966     * EPT use a root CR3 which will get flushed here.
     3967     */
    39573968    pVM->pgm.s.enmShadowMode = PGMMODE_INVALID;
    3958 
    3959     /* Reinit the current shadow paging mode as well; nested paging and EPT use a root CR3 which will get flushed here. */
    39603969    rc = PGMR3ChangeMode(pVM, PGMGetGuestMode(pVM));
    39613970    AssertRC(rc);
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