Changeset 28806 in vbox
- Timestamp:
- Apr 27, 2010 9:58:07 AM (15 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r28800 r28806 483 483 GMMCHUNKFREESET Shared; 484 484 485 /** Shared module tree (global). */ 486 PAVLGCPTRNODECORE pSharedModuleTree; 487 485 488 /** The maximum number of pages we're allowed to allocate. 486 489 * @gcfgm 64-bit GMM/MaxPages Direct. … … 3327 3330 unsigned cRegions, VMMDEVSHAREDREGIONDESC *pRegions) 3328 3331 { 3332 #ifdef VBOX_WITH_PAGE_SHARING 3333 /* 3334 * Validate input and get the basics. 3335 */ 3336 PGMM pGMM; 3337 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR); 3338 PGVM pGVM; 3339 int rc = GVMMR0ByVMAndEMT(pVM, idCpu, &pGVM); 3340 if (RT_FAILURE(rc)) 3341 return rc; 3342 3343 /* 3344 * Take the sempahore and do some more validations. 3345 */ 3346 rc = RTSemFastMutexRequest(pGMM->Mtx); 3347 AssertRC(rc); 3348 if (GMM_CHECK_SANITY_UPON_ENTERING(pGMM)) 3349 { 3350 /* Check if this module was already globally registered. */ 3351 PGMMSHAREDMODULE pRec = (PGMMSHAREDMODULE)RTAvlGCPtrGet(&pGMM->pSharedModuleTree, GCBaseAddr); 3352 if (!pRec) 3353 { 3354 pRec = (PGMMSHAREDMODULE)RTMemAllocZ(RT_OFFSETOF(GMMSHAREDMODULE, aRegions[cRegions])); 3355 pRec->Core.Key = GCBaseAddr; 3356 pRec->cbModule = cbModule; 3357 /* Input limit already safe; no need to check again. */ 3358 strcpy(pRec->szName, pszModuleName); 3359 strcpy(pRec->szVersion, pszVersion); 3360 3361 pRec->cRegions = cRegions; 3362 3363 for (unsigned i = 0; i < cRegions; i++) 3364 pRec->aRegions[i] = pRegions[i]; 3365 3366 /** @todo references to pages */ 3367 } 3368 else 3369 { 3370 } 3371 3372 GMM_CHECK_SANITY_UPON_LEAVING(pGMM); 3373 } 3374 else 3375 rc = VERR_INTERNAL_ERROR_5; 3376 3377 RTSemFastMutexRelease(pGMM->Mtx); 3378 return rc; 3379 #else 3329 3380 return VERR_NOT_IMPLEMENTED; 3381 #endif 3330 3382 } 3331 3383 -
trunk/src/VBox/VMM/VMMR0/GMMR0Internal.h
r28800 r28806 20 20 21 21 #include <VBox/gmm.h> 22 #include <iprt/avl.h> 22 23 23 24 /** … … 38 39 39 40 /** 41 * Shared module registration info 42 */ 43 typedef struct GMMSHAREDMODULE 44 { 45 /* Tree node. */ 46 AVLGCPTRNODECORE Core; 47 /** Shared module size. */ 48 uint32_t cbModule; 49 /** Number of included region descriptors */ 50 uint32_t cRegions; 51 /** Module name */ 52 char szName[GMM_SHARED_MODULE_MAX_NAME_STRING]; 53 /** Module version */ 54 char szVersion[GMM_SHARED_MODULE_MAX_VERSION_STRING]; 55 /** Shared region descriptor(s). */ 56 VMMDEVSHAREDREGIONDESC aRegions[1]; 57 } GMMSHAREDMODULE; 58 /** Pointer to a GMMMODULE. */ 59 typedef GMMSHAREDMODULE *PGMMSHAREDMODULE; 60 61 /** 40 62 * The per-VM GMM data. 41 63 */ … … 43 65 { 44 66 /** The reservations. */ 45 GMMVMSIZES Reserved;67 GMMVMSIZES Reserved; 46 68 /** The actual allocations. 47 69 * This includes both private and shared page allocations. */ 48 GMMVMSIZES Allocated;70 GMMVMSIZES Allocated; 49 71 50 72 /** The current number of private pages. */ 51 uint64_t cPrivatePages;73 uint64_t cPrivatePages; 52 74 /** The current number of shared pages. */ 53 uint64_t cSharedPages;75 uint64_t cSharedPages; 54 76 /** The current over-comitment policy. */ 55 GMMOCPOLICY enmPolicy;77 GMMOCPOLICY enmPolicy; 56 78 /** The VM priority for arbitrating VMs in low and out of memory situation. 57 79 * Like which VMs to start sequeezing first. */ 58 GMMPRIORITY enmPriority;80 GMMPRIORITY enmPriority; 59 81 60 82 /** The current number of ballooned pages. */ 61 uint64_t cBalloonedPages;83 uint64_t cBalloonedPages; 62 84 /** The max number of pages that can be ballooned. */ 63 uint64_t cMaxBalloonedPages;85 uint64_t cMaxBalloonedPages; 64 86 /** The number of pages we've currently requested the guest to give us. 65 87 * This is 0 if no pages currently requested. */ 66 uint64_t cReqBalloonedPages;88 uint64_t cReqBalloonedPages; 67 89 /** The number of pages the guest has given us in response to the request. 68 90 * This is not reset on request completed and may be used in later decisions. */ 69 uint64_t cReqActuallyBalloonedPages;91 uint64_t cReqActuallyBalloonedPages; 70 92 /** The number of pages we've currently requested the guest to take back. */ 71 uint64_t cReqDeflatePages; 93 uint64_t cReqDeflatePages; 94 72 95 /** Whether ballooning is enabled or not. */ 73 bool fBallooningEnabled; 96 bool fBallooningEnabled; 97 98 /** Whether shared paging is enabled or not. */ 99 bool fSharedPagingEnabled; 74 100 75 101 /** Whether the VM is allowed to allocate memory or not. 76 102 * This is used when the reservation update request fails or when the VM has 77 103 * been told to suspend/save/die in an out-of-memory case. */ 78 bool fMayAllocate;104 bool fMayAllocate; 79 105 } GMMPERVM; 80 106 /** Pointer to the per-VM GMM data. */
Note:
See TracChangeset
for help on using the changeset viewer.