Changeset 27038 in vbox
- Timestamp:
- Mar 4, 2010 2:48:14 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGM.cpp
r26718 r27038 1582 1582 STAM_REL_REG(pVM, &pPGM->StatLargePageReused, STAMTYPE_COUNTER, "/PGM/LargePage/Reused", STAMUNIT_OCCURENCES, "The number of times we've reused a large page."); 1583 1583 STAM_REL_REG(pVM, &pPGM->StatLargePageRefused, STAMTYPE_COUNTER, "/PGM/LargePage/Refused", STAMUNIT_OCCURENCES, "The number of times we couldn't use a large page."); 1584 STAM_REL_REG(pVM, &pPGM->StatLargePageRecheck, STAMTYPE_COUNTER, "/PGM/LargePage/Recheck", STAMUNIT_OCCURENCES, "The number of times we've rechecked a disabled large page."); 1584 1585 1585 1586 /* Live save */ -
trunk/src/VBox/VMM/PGMInternal.h
r27026 r27038 2789 2789 STAMCOUNTER StatLargePageReused; /**< The number of large pages we've reused.*/ 2790 2790 STAMCOUNTER StatLargePageRefused; /**< The number of times we couldn't use a large page.*/ 2791 STAMCOUNTER StatLargePageRecheck; /**< The number of times we rechecked a disabled large page.*/ 2791 2792 /** @} */ 2792 2793 … … 3332 3333 int pgmPhysAllocPage(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys); 3333 3334 int pgmPhysAllocLargePage(PVM pVM, RTGCPHYS GCPhys); 3335 int pgmPhysIsValidLargePage(PVM pVM, RTGCPHYS GCPhys, PPGMPAGE pLargePage); 3334 3336 int pgmPhysPageLoadIntoTlb(PPGM pPGM, RTGCPHYS GCPhys); 3335 3337 int pgmPhysPageLoadIntoTlbWithPage(PPGM pPGM, PPGMPAGE pPage, RTGCPHYS GCPhys); -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r27026 r27038 2975 2975 } 2976 2976 else 2977 if (PGM_PAGE_GET_PDE_TYPE(pPage) == PGM_PAGE_PDE_TYPE_PDE_DISABLED) 2978 { 2979 /* Recheck the entire 2 MB range to see if we can use it again as a large page. */ 2980 rc = pgmPhysIsValidLargePage(pVM, GCPtrPage, pPage); 2981 if (RT_SUCCESS(rc)) 2982 { 2983 Assert(PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ALLOCATED); 2984 Assert(PGM_PAGE_GET_PDE_TYPE(pPage) == PGM_PAGE_PDE_TYPE_PDE); 2985 HCPhys = PGM_PAGE_GET_HCPHYS(pPage); 2986 } 2987 } 2988 else 2977 2989 if (PGMIsUsingLargePages(pVM)) 2978 2990 { -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r27026 r27038 551 551 return VERR_PGM_INVALID_LARGE_PAGE_RANGE; 552 552 } 553 554 /** 555 * Recheck the entire 2 MB range to see if we can use it again as a large page. 556 * 557 * @returns The following VBox status codes. 558 * @retval VINF_SUCCESS on success, the large page can be used again 559 * @retval VERR_PGM_INVALID_LARGE_PAGE_RANGE if it can't be reused 560 * 561 * @param pVM The VM address. 562 * @param GCPhys The address of the page. 563 * @param pLargePage Page structure of the base page 564 */ 565 int pgmPhysIsValidLargePage(PVM pVM, RTGCPHYS GCPhys, PPGMPAGE pLargePage) 566 { 567 unsigned i; 568 569 STAM_REL_COUNTER_INC(&pVM->pgm.s.StatLargePageRecheck); 570 571 GCPhys &= X86_PDE2M_PAE_PG_MASK; 572 573 /* Check the base page. */ 574 Assert(PGM_PAGE_GET_PDE_TYPE(pLargePage) == PGM_PAGE_PDE_TYPE_PDE_DISABLED); 575 if ( PGM_PAGE_GET_STATE(pLargePage) != PGM_PAGE_STATE_ALLOCATED 576 || PGM_PAGE_GET_TYPE(pLargePage) != PGMPAGETYPE_RAM 577 || PGM_PAGE_GET_HNDL_PHYS_STATE(pLargePage) != PGM_PAGE_HNDL_PHYS_STATE_NONE) 578 { 579 LogFlow(("pgmPhysIsValidLargePage: checks failed for base page %x %x %x\n", PGM_PAGE_GET_STATE(pLargePage), PGM_PAGE_GET_TYPE(pLargePage), PGM_PAGE_GET_HNDL_PHYS_STATE(pLargePage))); 580 return VERR_PGM_INVALID_LARGE_PAGE_RANGE; 581 } 582 583 /* Check all remaining pages in the 2 MB range. */ 584 GCPhys += PAGE_SIZE; 585 for (i = 1; i < _2M/PAGE_SIZE; i++) 586 { 587 PPGMPAGE pPage; 588 int rc = pgmPhysGetPageEx(&pVM->pgm.s, GCPhys, &pPage); 589 AssertRCBreak(rc); 590 591 if ( PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED 592 || PGM_PAGE_GET_PDE_TYPE(pPage) != PGM_PAGE_PDE_TYPE_PDE 593 || PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_RAM 594 || PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) != PGM_PAGE_HNDL_PHYS_STATE_NONE) 595 { 596 LogFlow(("pgmPhysIsValidLargePage: checks failed for page %d; %x %x %x\n", i, PGM_PAGE_GET_STATE(pPage), PGM_PAGE_GET_TYPE(pPage), PGM_PAGE_GET_HNDL_PHYS_STATE(pPage))); 597 break; 598 } 599 600 GCPhys += PAGE_SIZE; 601 } 602 if (i == _2M/PAGE_SIZE) 603 { 604 PGM_PAGE_SET_PDE_TYPE(pLargePage, PGM_PAGE_PDE_TYPE_PDE); 605 Log(("pgmPhysIsValidLargePage: page %RGp can be reused!\n", GCPhys)); 606 return VINF_SUCCESS; 607 } 608 609 return VERR_PGM_INVALID_LARGE_PAGE_RANGE; 610 } 611 553 612 #endif /* PGM_WITH_LARGE_PAGES */ 554 613 -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r27026 r27038 3296 3296 Log(("pgmPoolTrackUpdateGCPhys: update large page PDE for %RGp (%RGp)\n", GCPhysBase, GCPhysPage)); 3297 3297 3298 /* Mark the large page as disabled as we need to break it up to change a single page in the 2 MB range. */ 3299 PGM_PAGE_SET_PDE_TYPE(pPhysBase, PGM_PAGE_PDE_TYPE_PDE_DISABLED); 3300 3301 /* Update the base as that *only* that one has a reference and there's only one PDE to clear. */ 3302 rc = pgmPoolTrackUpdateGCPhys(pVM, GCPhysBase, pPhysBase, fFlushPTEs, pfFlushTLBs); 3303 3304 *pfFlushTLBs = true; 3305 pgmUnlock(pVM); 3306 return rc; 3298 if (PGM_PAGE_GET_PDE_TYPE(pPhysBase) == PGM_PAGE_PDE_TYPE_PDE) 3299 { 3300 /* Mark the large page as disabled as we need to break it up to change a single page in the 2 MB range. */ 3301 PGM_PAGE_SET_PDE_TYPE(pPhysBase, PGM_PAGE_PDE_TYPE_PDE_DISABLED); 3302 3303 /* Update the base as that *only* that one has a reference and there's only one PDE to clear. */ 3304 rc = pgmPoolTrackUpdateGCPhys(pVM, GCPhysBase, pPhysBase, fFlushPTEs, pfFlushTLBs); 3305 3306 *pfFlushTLBs = true; 3307 pgmUnlock(pVM); 3308 return rc; 3309 } 3307 3310 } 3308 3311 #else
Note:
See TracChangeset
for help on using the changeset viewer.