Changeset 20151 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 29, 2009 12:40:31 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMHandler.cpp
r19141 r20151 388 388 if (enmType != PGMVIRTHANDLERTYPE_HYPERVISOR) 389 389 { 390 PVMCPU pVCpu = VMMGetCpu(pVM); 391 390 392 pVM->pgm.s.fPhysCacheFlushPending = true; 391 for (unsigned i=0;i<pVM->cCPUs;i++) 392 { 393 PVMCPU pVCpu = &pVM->aCpus[i]; 394 395 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL; 396 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 397 } 398 pVM->pgm.s.fGlobalSyncFlags |= PGM_GLOBAL_SYNC_CLEAR_PGM_POOL; 393 394 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL | PGM_SYNC_CLEAR_PGM_POOL; 395 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 399 396 } 400 397 pgmUnlock(pVM); … … 475 472 * Schedule CR3 sync. 476 473 */ 477 for (unsigned i=0;i<pVM->cCPUs;i++) 478 { 479 PVMCPU pVCpu = &pVM->aCpus[i]; 480 481 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL; 482 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 483 } 484 pVM->pgm.s.fGlobalSyncFlags |= PGM_GLOBAL_SYNC_CLEAR_PGM_POOL; 474 PVMCPU pVCpu = VMMGetCpu(pVM); 475 476 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL | PGM_SYNC_CLEAR_PGM_POOL; 477 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 485 478 } 486 479 else -
trunk/src/VBox/VMM/PGMInternal.h
r20136 r20151 2224 2224 bool afAlignment0[7]; 2225 2225 2226 /** What needs syncing (PGM_SYNC_*).2227 * This is used to queue operations for PGMSyncCR3, PGMInvalidatePage,2228 * PGMFlushTLB, and PGMR3Load. */2229 RTUINT fGlobalSyncFlags;2230 2231 2226 /* 2232 2227 * This will be redefined at least two more times before we're done, I'm sure. … … 2917 2912 #define PGM_SYNC_MAP_CR3 RT_BIT(3) 2918 2913 /** Clear the page pool (a light weight flush). */ 2919 #define PGM_ GLOBAL_SYNC_CLEAR_PGM_POOL_BIT82920 #define PGM_ GLOBAL_SYNC_CLEAR_PGM_POOL RT_BIT(PGM_GLOBAL_SYNC_CLEAR_PGM_POOL_BIT)2914 #define PGM_SYNC_CLEAR_PGM_POOL_BIT 8 2915 #define PGM_SYNC_CLEAR_PGM_POOL RT_BIT(PGM_SYNC_CLEAR_PGM_POOL_BIT) 2921 2916 /** @} */ 2922 2917 … … 2983 2978 void pgmPoolClearAll(PVM pVM); 2984 2979 PPGMPOOLPAGE pgmPoolGetPage(PPGMPOOL pPool, RTHCPHYS HCPhys); 2985 int pgmPoolSyncCR3(PVM pVM);2980 int pgmPoolSyncCR3(PVMCPU pVCpu); 2986 2981 int pgmPoolTrackFlushGCPhys(PVM pVM, PPGMPAGE pPhysPage, bool *pfFlushTLBs); 2987 2982 uint16_t pgmPoolTrackPhysExtAddref(PVM pVM, uint16_t u16, uint16_t iShwPT); -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r20068 r20151 1774 1774 * clear the whole thing. 1775 1775 */ 1776 rc = pgmPoolSyncCR3(pV M);1776 rc = pgmPoolSyncCR3(pVCpu); 1777 1777 if (rc != VINF_SUCCESS) 1778 1778 return rc; … … 1833 1833 #ifdef IN_RING3 1834 1834 if (rc == VINF_PGM_SYNC_CR3) 1835 rc = pgmPoolSyncCR3(pV M);1835 rc = pgmPoolSyncCR3(pVCpu); 1836 1836 #else 1837 1837 if (rc == VINF_PGM_SYNC_CR3) -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r20140 r20151 1746 1746 * the heap size should suffice. */ 1747 1747 AssertFatalMsgRC(rc, ("PGMHandlerPhysicalRegisterEx %RGp failed with %Rrc\n", GCPhysPage, rc)); 1748 Assert(!( pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3));1748 Assert(!(VMMGetCpu(pVM)->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3)); 1749 1749 } 1750 1750 pPage->fMonitored = true; … … 1843 1843 rc = PGMHandlerPhysicalDeregister(pVM, pPage->GCPhys & ~(RTGCPHYS)(PAGE_SIZE - 1)); 1844 1844 AssertFatalRC(rc); 1845 AssertMsg(!(pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3), 1846 ("%#x %#x\n", pVM->pgm.s.fGlobalSyncFlags, pVM->fGlobalForcedActions)); 1845 #ifdef VBOX_STRICT 1846 PVMCPU pVCpu = VMMGetCpu(pVM); 1847 #endif 1848 AssertMsg(!(pVCpu->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3), 1849 ("%#x %#x\n", pVCpu->pgm.s.fSyncFlags, pVM->fGlobalForcedActions)); 1847 1850 } 1848 1851 pPage->fMonitored = false; … … 2075 2078 #endif 2076 2079 2080 /* Clear the PGM_SYNC_CLEAR_PGM_POOL flag on all VCPUs to prevent redundant flushes. */ 2081 for (unsigned idCpu = 0; idCpu < pVM->cCPUs; idCpu++) 2082 { 2083 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 2084 2085 pVCpu->pgm.s.fSyncFlags &= ~PGM_SYNC_CLEAR_PGM_POOL; 2086 } 2087 2077 2088 pPool->cPresent = 0; 2078 2089 pgmUnlock(pVM); … … 2090 2101 * @retval VINF_SUCCESS if successfully added. 2091 2102 * @retval VINF_PGM_SYNC_CR3 is it needs to be deferred to ring 3 (GC only) 2092 * @param pV M The VMhandle.2103 * @param pVCpu The VMCPU handle. 2093 2104 * @remark Should only be used when monitoring is available, thus placed in 2094 2105 * the PGMPOOL_WITH_MONITORING #ifdef. 2095 2106 */ 2096 int pgmPoolSyncCR3(PVM pVM) 2097 { 2107 int pgmPoolSyncCR3(PVMCPU pVCpu) 2108 { 2109 PVM pVM = pVCpu->CTX_SUFF(pVM); 2098 2110 LogFlow(("pgmPoolSyncCR3\n")); 2099 2111 /* … … 2104 2116 */ 2105 2117 # ifdef IN_RING3 /* Don't flush in ring-0 or raw mode, it's taking too long. */ 2106 if (ASMBitTestAndClear(&pV M->pgm.s.fGlobalSyncFlags, PGM_GLOBAL_SYNC_CLEAR_PGM_POOL_BIT))2118 if (ASMBitTestAndClear(&pVCpu->pgm.s.fSyncFlags, PGM_SYNC_CLEAR_PGM_POOL_BIT)) 2107 2119 { 2108 2120 VMMR3AtomicExecuteHandler(pVM, pgmPoolClearAll, NULL); 2109 2121 # else /* !IN_RING3 */ 2110 if (pV M->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL)2111 { 2112 LogFlow(("SyncCR3: PGM_ GLOBAL_SYNC_CLEAR_PGM_POOL is set -> VINF_PGM_SYNC_CR3\n"));2113 VMCPU_FF_SET( VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3); /** @todo no need to do global sync, right? */2122 if (pVCpu->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL) 2123 { 2124 LogFlow(("SyncCR3: PGM_SYNC_CLEAR_PGM_POOL is set -> VINF_PGM_SYNC_CR3\n")); 2125 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); /** @todo no need to do global sync, right? */ 2114 2126 return VINF_PGM_SYNC_CR3; 2115 2127 # endif /* !IN_RING3 */ … … 2749 2761 if (rc == VINF_PGM_GCPHYS_ALIASED) 2750 2762 { 2751 pV M->pgm.s.fGlobalSyncFlags |= PGM_GLOBAL_SYNC_CLEAR_PGM_POOL;2763 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL; 2752 2764 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 2753 2765 rc = VINF_PGM_SYNC_CR3; … … 4048 4060 /** @todo CSAM/PGMPrefetchPage messes up here during CSAMR3CheckGates 4049 4061 * (TRPMR3SyncIDT) because of FF priority. Try fix that? 4050 * Assert(!(pVM->pgm.s.fGlobalSyncFlags & PGM_ GLOBAL_SYNC_CLEAR_PGM_POOL)); */4062 * Assert(!(pVM->pgm.s.fGlobalSyncFlags & PGM_SYNC_CLEAR_PGM_POOL)); */ 4051 4063 4052 4064 pgmLock(pVM); -
trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp
r20135 r20151 475 475 GEN_CHECK_OFF(PGM, offVCpuPGM); 476 476 GEN_CHECK_OFF(PGM, fRamPreAlloc); 477 GEN_CHECK_OFF(PGM, fGlobalSyncFlags);478 477 GEN_CHECK_OFF(PGM, paDynPageMap32BitPTEsGC); 479 478 GEN_CHECK_OFF(PGM, paDynPageMapPaePTEsGC);
Note:
See TracChangeset
for help on using the changeset viewer.