Changeset 92326 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Nov 10, 2021 3:14:52 PM (3 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/GMM.cpp
r92248 r92326 109 109 #ifdef LOG_ENABLED 110 110 for (uint32_t iPage = 0; iPage < pReq->cPages; iPage++) 111 Log3(("GMMR3AllocatePagesPerform: idPage=%#x HCPhys=%RHp \n",112 pReq->aPages[iPage].idPage, pReq->aPages[iPage].HCPhysGCPhys ));111 Log3(("GMMR3AllocatePagesPerform: idPage=%#x HCPhys=%RHp fZeroed=%d\n", 112 pReq->aPages[iPage].idPage, pReq->aPages[iPage].HCPhysGCPhys, pReq->aPages[iPage].fZeroed)); 113 113 #endif 114 114 return rc; -
trunk/src/VBox/VMM/VMMR3/PGM.cpp
r92248 r92326 755 755 for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.aHandyPages); i++) 756 756 { 757 pVM->pgm.s.aHandyPages[i].HCPhysGCPhys = NIL_RTHCPHYS; 757 pVM->pgm.s.aHandyPages[i].HCPhysGCPhys = NIL_GMMPAGEDESC_PHYS; 758 pVM->pgm.s.aHandyPages[i].fZeroed = false; 758 759 pVM->pgm.s.aHandyPages[i].idPage = NIL_GMM_PAGEID; 759 760 pVM->pgm.s.aHandyPages[i].idSharedPage = NIL_GMM_PAGEID; … … 762 763 for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.aLargeHandyPage); i++) 763 764 { 764 pVM->pgm.s.aLargeHandyPage[i].HCPhysGCPhys = NIL_RTHCPHYS; 765 pVM->pgm.s.aLargeHandyPage[i].HCPhysGCPhys = NIL_GMMPAGEDESC_PHYS; 766 pVM->pgm.s.aLargeHandyPage[i].fZeroed = false; 765 767 pVM->pgm.s.aLargeHandyPage[i].idPage = NIL_GMM_PAGEID; 766 768 pVM->pgm.s.aLargeHandyPage[i].idSharedPage = NIL_GMM_PAGEID; -
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r92248 r92326 4403 4403 { 4404 4404 pReq->aPages[iPage].HCPhysGCPhys = GCPhys + (iPage << PAGE_SHIFT); 4405 pReq->aPages[iPage].idPage = NIL_GMM_PAGEID; 4405 pReq->aPages[iPage].fZeroed = false; 4406 pReq->aPages[iPage].idPage = NIL_GMM_PAGEID; 4406 4407 pReq->aPages[iPage].idSharedPage = NIL_GMM_PAGEID; 4407 4408 } … … 5840 5841 uint32_t idPage = pVM->pgm.s.aLargeHandyPage[0].idPage; 5841 5842 RTHCPHYS HCPhys = pVM->pgm.s.aLargeHandyPage[0].HCPhysGCPhys; 5842 5843 void *pv; 5844 5845 /* Map the large page into our address space. 5846 * 5847 * Note: assuming that within the 2 MB range: 5848 * - GCPhys + PAGE_SIZE = HCPhys + PAGE_SIZE (whole point of this exercise) 5849 * - user space mapping is continuous as well 5850 * - page id (GCPhys) + 1 = page id (GCPhys + PAGE_SIZE) 5843 Assert(pVM->pgm.s.aLargeHandyPage[0].fZeroed); 5844 5845 /* 5846 * Enter the pages into PGM. 5851 5847 */ 5852 rc = pgmPhysPageMapByPageID(pVM, idPage, HCPhys, &pv); 5853 AssertLogRelMsg(RT_SUCCESS(rc), ("idPage=%#x HCPhysGCPhys=%RHp rc=%Rrc\n", idPage, HCPhys, rc)); 5854 5855 if (RT_SUCCESS(rc)) 5856 { 5848 STAM_PROFILE_START(&pVM->pgm.s.Stats.StatClearLargePage, b); 5849 for (unsigned i = 0; i < _2M/PAGE_SIZE; i++) 5850 { 5851 PPGMPAGE pPage; 5852 rc = pgmPhysGetPageEx(pVM, GCPhys, &pPage); 5853 AssertRC(rc); 5854 5855 Assert(PGM_PAGE_IS_ZERO(pPage)); 5856 STAM_COUNTER_INC(&pVM->pgm.s.Stats.StatRZPageReplaceZero); 5857 pVM->pgm.s.cZeroPages--; 5858 5857 5859 /* 5858 * Clear the pages.5860 * Do the PGMPAGE modifications. 5859 5861 */ 5860 STAM_PROFILE_START(&pVM->pgm.s.Stats.StatClearLargePage, b); 5861 for (unsigned i = 0; i < _2M/PAGE_SIZE; i++) 5862 { 5863 ASMMemZeroPage(pv); 5864 5865 PPGMPAGE pPage; 5866 rc = pgmPhysGetPageEx(pVM, GCPhys, &pPage); 5867 AssertRC(rc); 5868 5869 Assert(PGM_PAGE_IS_ZERO(pPage)); 5870 STAM_COUNTER_INC(&pVM->pgm.s.Stats.StatRZPageReplaceZero); 5871 pVM->pgm.s.cZeroPages--; 5872 5873 /* 5874 * Do the PGMPAGE modifications. 5875 */ 5876 pVM->pgm.s.cPrivatePages++; 5877 PGM_PAGE_SET_HCPHYS(pVM, pPage, HCPhys); 5878 PGM_PAGE_SET_PAGEID(pVM, pPage, idPage); 5879 PGM_PAGE_SET_STATE(pVM, pPage, PGM_PAGE_STATE_ALLOCATED); 5880 PGM_PAGE_SET_PDE_TYPE(pVM, pPage, PGM_PAGE_PDE_TYPE_PDE); 5881 PGM_PAGE_SET_PTE_INDEX(pVM, pPage, 0); 5882 PGM_PAGE_SET_TRACKING(pVM, pPage, 0); 5883 5884 /* Somewhat dirty assumption that page ids are increasing. */ 5885 idPage++; 5886 5887 HCPhys += PAGE_SIZE; 5888 GCPhys += PAGE_SIZE; 5889 5890 pv = (void *)((uintptr_t)pv + PAGE_SIZE); 5891 5892 Log3(("PGMR3PhysAllocateLargePage: idPage=%#x HCPhys=%RGp\n", idPage, HCPhys)); 5893 } 5894 STAM_PROFILE_STOP(&pVM->pgm.s.Stats.StatClearLargePage, b); 5895 5896 /* Flush all TLBs. */ 5897 PGM_INVL_ALL_VCPU_TLBS(pVM); 5898 pgmPhysInvalidatePageMapTLB(pVM); 5899 } 5862 pVM->pgm.s.cPrivatePages++; 5863 PGM_PAGE_SET_HCPHYS(pVM, pPage, HCPhys); 5864 PGM_PAGE_SET_PAGEID(pVM, pPage, idPage); 5865 PGM_PAGE_SET_STATE(pVM, pPage, PGM_PAGE_STATE_ALLOCATED); 5866 PGM_PAGE_SET_PDE_TYPE(pVM, pPage, PGM_PAGE_PDE_TYPE_PDE); 5867 PGM_PAGE_SET_PTE_INDEX(pVM, pPage, 0); 5868 PGM_PAGE_SET_TRACKING(pVM, pPage, 0); 5869 5870 /* Somewhat dirty assumption that page ids are increasing. */ 5871 idPage++; 5872 5873 HCPhys += PAGE_SIZE; 5874 GCPhys += PAGE_SIZE; 5875 Log3(("PGMR3PhysAllocateLargePage: idPage=%#x HCPhys=%RGp\n", idPage, HCPhys)); 5876 } 5877 STAM_PROFILE_STOP(&pVM->pgm.s.Stats.StatClearLargePage, b); 5878 5879 /* Flush all TLBs. */ 5880 PGM_INVL_ALL_VCPU_TLBS(pVM); 5881 pgmPhysInvalidatePageMapTLB(pVM); 5882 5900 5883 pVM->pgm.s.cLargeHandyPages = 0; 5901 5884 } … … 6003 5986 { 6004 5987 PGMMPAGEDESC pPage = &pVM->pgm.s.aHandyPages[iClear]; 6005 void *pv; 6006 rc = pgmPhysPageMapByPageID(pVM, pPage->idPage, pPage->HCPhysGCPhys, &pv); 6007 AssertLogRelMsgBreak(RT_SUCCESS(rc), 6008 ("%u/%u: idPage=%#x HCPhysGCPhys=%RHp rc=%Rrc\n", 6009 iClear, pVM->pgm.s.cHandyPages, pPage->idPage, pPage->HCPhysGCPhys, rc)); 6010 ASMMemZeroPage(pv); 5988 if (!pPage->fZeroed) 5989 { 5990 void *pv; 5991 rc = pgmPhysPageMapByPageID(pVM, pPage->idPage, pPage->HCPhysGCPhys, &pv); 5992 AssertLogRelMsgBreak(RT_SUCCESS(rc), 5993 ("%u/%u: idPage=%#x HCPhysGCPhys=%RHp rc=%Rrc\n", 5994 iClear, pVM->pgm.s.cHandyPages, pPage->idPage, pPage->HCPhysGCPhys, rc)); 5995 ASMMemZeroPage(pv); 5996 pPage->fZeroed = true; 5997 } 5998 #ifdef VBOX_STRICT 5999 else 6000 { 6001 void *pv; 6002 rc = pgmPhysPageMapByPageID(pVM, pPage->idPage, pPage->HCPhysGCPhys, &pv); 6003 AssertLogRelMsgBreak(RT_SUCCESS(rc), 6004 ("%u/%u: idPage=%#x HCPhysGCPhys=%RHp rc=%Rrc\n", 6005 iClear, pVM->pgm.s.cHandyPages, pPage->idPage, pPage->HCPhysGCPhys, rc)); 6006 Assert(ASMMemIsZeroPage(pv)); 6007 } 6008 #endif 6011 6009 iClear++; 6012 6010 Log3(("PGMR3PhysAllocateHandyPages: idPage=%#x HCPhys=%RGp\n", pPage->idPage, pPage->HCPhysGCPhys));
Note:
See TracChangeset
for help on using the changeset viewer.