Changeset 43045 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 28, 2012 2:21:43 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r42976 r43045 3288 3288 Assert(pGMM->cAllocatedPages > 0); 3289 3289 Assert(!pPage->Shared.cRefs); 3290 #if defined(VBOX_WITH_PAGE_SHARING) && defined(VBOX_STRICT) && HC_ARCH_BITS == 643291 if (pPage->Shared.u14Checksum)3292 {3293 uint32_t uChecksum = gmmR0StrictPageChecksum(pGMM, pGVM, idPage);3294 uChecksum &= UINT32_C(0x00003fff);3295 AssertMsg(!uChecksum || uChecksum == pPage->Shared.u14Checksum,3296 ("%#x vs %#x - idPage=%#x\n", uChecksum, pPage->Shared.u14Checksum, idPage));3297 }3298 #endif3299 3290 3300 3291 pChunk->cShared--; … … 3404 3395 { 3405 3396 Assert(pGVM->gmm.s.Stats.cSharedPages); 3397 Assert(pPage->Shared.cRefs); 3398 #if defined(VBOX_WITH_PAGE_SHARING) && defined(VBOX_STRICT) && HC_ARCH_BITS == 64 3399 if (pPage->Shared.u14Checksum) 3400 { 3401 uint32_t uChecksum = gmmR0StrictPageChecksum(pGMM, pGVM, idPage); 3402 uChecksum &= UINT32_C(0x00003fff); 3403 AssertMsg(!uChecksum || uChecksum == pPage->Shared.u14Checksum, 3404 ("%#x vs %#x - idPage=%#x\n", uChecksum, pPage->Shared.u14Checksum, idPage)); 3405 } 3406 #endif 3406 3407 pGVM->gmm.s.Stats.cSharedPages--; 3407 Assert(pPage->Shared.cRefs);3408 3408 if (!--pPage->Shared.cRefs) 3409 3409 gmmR0FreeSharedPage(pGMM, pGVM, idPage, pPage); … … 4706 4706 * @param pPage The page structure. 4707 4707 */ 4708 DECLINLINE(void) gmmR0ConvertToSharedPage(PGMM pGMM, PGVM pGVM, RTHCPHYS HCPhys, uint32_t idPage, PGMMPAGE pPage) 4708 DECLINLINE(void) gmmR0ConvertToSharedPage(PGMM pGMM, PGVM pGVM, RTHCPHYS HCPhys, uint32_t idPage, PGMMPAGE pPage, 4709 PGMMSHAREDPAGEDESC pPageDesc) 4709 4710 { 4710 4711 PGMMCHUNK pChunk = gmmR0GetChunk(pGMM, idPage >> GMM_CHUNKID_SHIFT); … … 4725 4726 pPage->Shared.cRefs = 1; 4726 4727 #ifdef VBOX_STRICT 4727 pPage->Shared.u14Checksum = gmmR0StrictPageChecksum(pGMM, pGVM, idPage); 4728 pPageDesc->u32StrictChecksum = gmmR0StrictPageChecksum(pGMM, pGVM, idPage); 4729 pPage->Shared.u14Checksum = pPageDesc->u32StrictChecksum; 4728 4730 #else 4729 4731 pPage->Shared.u14Checksum = 0; … … 4745 4747 AssertMsg(pPageDesc->GCPhys == (pPage->Private.pfn << 12), ("desc %RGp gmm %RGp\n", pPageDesc->HCPhys, (pPage->Private.pfn << 12))); 4746 4748 4747 gmmR0ConvertToSharedPage(pGMM, pGVM, pPageDesc->HCPhys, pPageDesc->idPage, pPage );4749 gmmR0ConvertToSharedPage(pGMM, pGVM, pPageDesc->HCPhys, pPageDesc->idPage, pPage, pPageDesc); 4748 4750 4749 4751 /* Keep track of these references. */ … … 4779 4781 PGMM pGMM; 4780 4782 GMM_GET_VALID_INSTANCE(pGMM, VERR_GMM_INSTANCE); 4783 pPageDesc->u32StrictChecksum = 0; 4781 4784 4782 4785 AssertMsgReturn(idxRegion < pModule->cRegions, … … 4873 4876 } 4874 4877 uint8_t *pbSharedPage = pbChunk + ((pGlobalRegion->paidPages[idxPage] & GMM_PAGEID_IDX_MASK) << PAGE_SHIFT); 4878 4875 4879 #ifdef VBOX_STRICT 4876 if (pPage->Shared.u14Checksum) 4877 { 4878 uint32_t uChecksum = RTCrc32(pbSharedPage, PAGE_SIZE) & UINT32_C(0x00003fff); 4879 AssertMsg(!uChecksum || uChecksum == pPage->Shared.u14Checksum, 4880 ("%#x vs %#x - idPage=%# - %s %s\n", uChecksum, pPage->Shared.u14Checksum, 4881 pGlobalRegion->paidPages[idxPage], pModule->szName, pModule->szVersion)); 4882 } 4880 pPageDesc->u32StrictChecksum = RTCrc32(pbSharedPage, PAGE_SIZE); 4881 uint32_t uChecksum = pPageDesc->u32StrictChecksum & UINT32_C(0x00003fff); 4882 AssertMsg(!uChecksum || uChecksum == pPage->Shared.u14Checksum || !pPage->Shared.u14Checksum, 4883 ("%#x vs %#x - idPage=%# - %s %s\n", uChecksum, pPage->Shared.u14Checksum, 4884 pGlobalRegion->paidPages[idxPage], pModule->szName, pModule->szVersion)); 4883 4885 #endif 4884 4886 … … 4948 4950 RTAvlGCPtrDestroy(&pGVM->gmm.s.pSharedModuleTree, gmmR0CleanupSharedModule, &Args); 4949 4951 4950 Assert (pGVM->gmm.s.Stats.cShareableModules == 0);4952 AssertMsg(pGVM->gmm.s.Stats.cShareableModules == 0, ("%d\n", pGVM->gmm.s.Stats.cShareableModules)); 4951 4953 pGVM->gmm.s.Stats.cShareableModules = 0; 4952 4954 -
trunk/src/VBox/VMM/VMMR0/PGMR0SharedPage.cpp
r43042 r43045 130 130 pVM->pgm.s.cPrivatePages--; 131 131 PGM_PAGE_SET_STATE(pVM, pPage, PGM_PAGE_STATE_SHARED); 132 133 # ifdef VBOX_STRICT /* check sum hack */ 134 pPage->s.u2Unused0 = PageDesc.u32StrictChecksum & 3; 135 pPage->s.u2Unused1 = (PageDesc.u32StrictChecksum >> 8) & 3; 136 # endif 132 137 } 133 138 } -
trunk/src/VBox/VMM/VMMR3/GMM.cpp
r41965 r43045 5 5 6 6 /* 7 * Copyright (C) 2008 Oracle Corporation7 * Copyright (C) 2008-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 287 287 } 288 288 289 289 290 /** 290 291 * @see GMMR0QueryVMMMemoryStatsReq … … 317 318 } 318 319 320 319 321 /** 320 322 * @see GMMR0QueryMemoryStatsReq … … 343 345 } 344 346 347 345 348 /** 346 349 * @see GMMR0MapUnmapChunk … … 360 363 } 361 364 365 362 366 /** 363 367 * @see GMMR0FreeLargePage … … 371 375 return VMMR3CallR0(pVM, VMMR0_DO_GMM_FREE_LARGE_PAGE, 0, &Req.Hdr); 372 376 } 377 373 378 374 379 /** … … 394 399 } 395 400 401 396 402 /** 397 403 * @see GMMR0RegisterSharedModule … … 404 410 } 405 411 412 406 413 /** 407 414 * @see GMMR0ResetSharedModules … … 412 419 } 413 420 421 414 422 /** 415 423 * @see GMMR0CheckSharedModules … … 419 427 return VMMR3CallR0(pVM, VMMR0_DO_GMM_CHECK_SHARED_MODULES, 0, NULL); 420 428 } 429 421 430 422 431 #if defined(VBOX_STRICT) && HC_ARCH_BITS == 64 … … 436 445 if (rc == VINF_SUCCESS) 437 446 return Req.fDuplicate; 438 else 439 return false; 447 return false; 440 448 } 441 449 #endif /* VBOX_STRICT && HC_ARCH_BITS == 64 */ -
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r41965 r43045 39 39 #include <iprt/alloc.h> 40 40 #include <iprt/asm.h> 41 #ifdef VBOX_STRICT 42 # include <iprt/crc.h> 43 #endif 41 44 #include <iprt/thread.h> 42 45 #include <iprt/string.h> … … 1817 1820 1818 1821 /** 1822 * Checks shared page checksums. 1823 * 1824 * @param pVM Pointer to the shared VM structure. 1825 */ 1826 void pgmR3PhysAssertSharedPageChecksums(PVM pVM) 1827 { 1828 #ifdef VBOX_STRICT 1829 pgmLock(pVM); 1830 1831 if (pVM->pgm.s.cSharedPages > 0) 1832 { 1833 /* 1834 * Walk the ram ranges. 1835 */ 1836 for (PPGMRAMRANGE pRam = pVM->pgm.s.pRamRangesXR3; pRam; pRam = pRam->pNextR3) 1837 { 1838 uint32_t iPage = pRam->cb >> PAGE_SHIFT; 1839 AssertMsg(((RTGCPHYS)iPage << PAGE_SHIFT) == pRam->cb, ("%RGp %RGp\n", (RTGCPHYS)iPage << PAGE_SHIFT, pRam->cb)); 1840 1841 while (iPage-- > 0) 1842 { 1843 PPGMPAGE pPage = &pRam->aPages[iPage]; 1844 if (PGM_PAGE_IS_SHARED(pPage)) 1845 { 1846 uint32_t u32Checksum = pPage->s.u2Unused0 | ((uint32_t)pPage->s.u2Unused1 << 8); 1847 if (!u32Checksum) 1848 { 1849 RTGCPHYS GCPhysPage = pRam->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT); 1850 void const *pvPage; 1851 int rc = pgmPhysPageMapReadOnly(pVM, pPage, GCPhysPage, &pvPage); 1852 if (RT_SUCCESS(rc)) 1853 { 1854 uint32_t u32Checksum2 = RTCrc32(pvPage, PAGE_SIZE); 1855 # if 0 1856 AssertMsg((u32Checksum2 & UINT32_C(0x00000303)) == u32Checksum, ("GCPhysPage=%RGp\n", GCPhysPage)); 1857 # else 1858 if ((u32Checksum2 & UINT32_C(0x00000303)) == u32Checksum) 1859 LogFlow(("shpg %#x @ %RGp %#x [OK]\n", PGM_PAGE_GET_PAGEID(pPage), GCPhysPage, u32Checksum2)); 1860 else 1861 AssertMsgFailed(("shpg %#x @ %RGp %#x\n", PGM_PAGE_GET_PAGEID(pPage), GCPhysPage, u32Checksum2)); 1862 # endif 1863 } 1864 else 1865 AssertRC(rc); 1866 } 1867 } 1868 1869 } /* for each page */ 1870 1871 } /* for each ram range */ 1872 } 1873 1874 pgmUnlock(pVM); 1875 #endif /* VBOX_STRICT */ 1876 NOREF(pVM); 1877 } 1878 1879 1880 /** 1819 1881 * Resets (zeros) the RAM. 1820 1882 * … … 1834 1896 #ifdef VBOX_WITH_PAGE_SHARING 1835 1897 /* Clear all registered shared modules. */ 1898 pgmR3PhysAssertSharedPageChecksums(pVM); 1836 1899 rc = GMMR3ResetSharedModules(pVM); 1837 1900 AssertRC(rc); … … 1978 2041 } 1979 2042 2043 1980 2044 /** 1981 2045 * Frees all RAM during VM termination … … 1996 2060 #ifdef VBOX_WITH_PAGE_SHARING 1997 2061 /* Clear all registered shared modules. */ 2062 pgmR3PhysAssertSharedPageChecksums(pVM); 1998 2063 rc = GMMR3ResetSharedModules(pVM); 1999 2064 AssertRC(rc); … … 2017 2082 AssertMsg(((RTGCPHYS)iPage << PAGE_SHIFT) == pRam->cb, ("%RGp %RGp\n", (RTGCPHYS)iPage << PAGE_SHIFT, pRam->cb)); 2018 2083 2019 /* Replace all RAM pages by ZERO pages. */2020 2084 while (iPage-- > 0) 2021 2085 { … … 2025 2089 case PGMPAGETYPE_RAM: 2026 2090 /* Free all shared pages. Private pages are automatically freed during GMM VM cleanup. */ 2091 /** @todo change this to explicitly free private pages here. */ 2027 2092 if (PGM_PAGE_IS_SHARED(pPage)) 2028 2093 { -
trunk/src/VBox/VMM/VMMR3/PGMSharedPage.cpp
r41803 r43045 99 99 * Issue the request. In strict builds, do some local tracking. 100 100 */ 101 pgmR3PhysAssertSharedPageChecksums(pVM); 101 102 rc = GMMR3RegisterSharedModule(pVM, pReq); 102 103 if (RT_SUCCESS(rc)) … … 165 166 if (RT_SUCCESS(rc)) 166 167 { 168 pgmR3PhysAssertSharedPageChecksums(pVM); 167 169 rc = GMMR3UnregisterSharedModule(pVM, pReq); 170 pgmR3PhysAssertSharedPageChecksums(pVM); 168 171 169 172 # ifdef VBOX_STRICT … … 211 214 } 212 215 216 213 217 /* Flush all pending handy page operations before changing any shared page assignments. */ 214 218 int rc = PGMR3PhysAllocateHandyPages(pVM); 215 219 AssertRC(rc); 216 220 217 /* Lock it here as we can't deal with busy locks in this ring-0 path. */ 221 /* 222 * Lock it here as we can't deal with busy locks in this ring-0 path. 223 */ 224 LogFlow(("pgmR3SharedModuleRegRendezvous: start (%d)\n", pVM->pgm.s.cSharedPages)); 225 218 226 pgmLock(pVM); 227 pgmR3PhysAssertSharedPageChecksums(pVM); 219 228 rc = GMMR3CheckSharedModules(pVM); 229 pgmR3PhysAssertSharedPageChecksums(pVM); 220 230 pgmUnlock(pVM); 221 231 AssertLogRelRC(rc); 222 232 233 LogFlow(("pgmR3SharedModuleRegRendezvous: done (%d)\n", pVM->pgm.s.cSharedPages)); 223 234 return rc; 224 235 } -
trunk/src/VBox/VMM/include/PGMInternal.h
r43025 r43045 3960 3960 int pgmR3PhysRamTerm(PVM pVM); 3961 3961 void pgmR3PhysRomTerm(PVM pVM); 3962 void pgmR3PhysAssertSharedPageChecksums(PVM pVM); 3962 3963 3963 3964 int pgmR3PoolInit(PVM pVM);
Note:
See TracChangeset
for help on using the changeset viewer.