- Timestamp:
- Mar 5, 2010 5:16:36 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/gmm.h
r27102 r27116 185 185 } GMMACCOUNT; 186 186 187 /** 188 * Balloon action enum. 187 188 /** 189 * Balloon actions. 189 190 */ 190 191 typedef enum 191 192 { 193 /** Invalid zero entry. */ 192 194 GMMBALLOONACTION_INVALID = 0, 193 GMMBALLOONACTION_INFLATE = 1, 194 GMMBALLOONACTION_DEFLATE = 2, 195 GMMBALLOONACTION_RESET = 3, 195 /** Inflate the balloon. */ 196 GMMBALLOONACTION_INFLATE, 197 /** Deflate the balloon. */ 198 GMMBALLOONACTION_DEFLATE, 199 /** Puncture the balloon because of VM reset. */ 200 GMMBALLOONACTION_RESET, 201 /** End of the valid actions. */ 202 GMMBALLOONACTION_END, 196 203 /** hack forcing the size of the enum to 32-bits. */ 197 204 GMMBALLOONACTION_MAKE_32BIT_HACK = 0x7fffffff 198 205 } GMMBALLOONACTION; 206 199 207 200 208 /** -
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r27103 r27116 2842 2842 * 2843 2843 * @returns VBox status code: 2844 * @retval xxx 2844 * @retval VERR_GMM_ATTEMPT_TO_FREE_TOO_MUCH 2845 * @retval VERR_GMM_ATTEMPT_TO_DEFLATE_TOO_MUCH 2846 * @retval VERR_GMM_OVERCOMMITED_TRY_AGAIN_IN_A_BIT - reset condition 2847 * indicating that we won't neceessarily have sufficient RAM to boot 2848 * the VM again and that it should pause until this changes (we'll try 2849 * balloon some other VM). (For standard deflate we have little choice 2850 * but to hope the VM won't use the memory that was returned to it.) 2845 2851 * 2846 2852 * @param pVM Pointer to the shared VM structure. … … 2918 2924 pGMM->cBalloonedPages -= cBalloonedPages; 2919 2925 pGVM->gmm.s.cBalloonedPages -= cBalloonedPages; 2920 Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx (user)\n", 2921 cBalloonedPages, pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages)); 2926 if (pGVM->gmm.s.cReqDeflatePages) 2927 { 2928 AssertFailed(); /* This is path is for later. */ 2929 Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx Req=%#llx\n", cPages, 2930 pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages, pGVM->gmm.s.cReqDeflatePages)); 2931 2932 /* 2933 * Anything we need to do here now when the request has been completed? 2934 */ 2935 pGVM->gmm.s.cReqDeflatePages = 0; 2936 } 2937 else 2938 Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx (user)\n", cPages, 2939 pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages)); 2922 2940 } 2923 2941 else … … 2971 2989 2972 2990 return GMMR0BalloonedPages(pVM, idCpu, pReq->enmAction, pReq->cBalloonedPages); 2973 }2974 2975 2976 /**2977 * Report balloon deflating.2978 *2979 * @returns VBox status code:2980 * @retval xxx2981 *2982 * @param pVM Pointer to the shared VM structure.2983 * @param idCpu VCPU id2984 * @param cPages The number of pages that was let out of the balloon.2985 * @thread EMT.2986 */2987 GMMR0DECL(int) GMMR0DeflatedBalloon(PVM pVM, VMCPUID idCpu, uint32_t cPages)2988 {2989 LogFlow(("GMMR0DeflatedBalloon: pVM=%p cPages=%#x\n", pVM, cPages));2990 2991 /*2992 * Validate input and get the basics.2993 */2994 PGMM pGMM;2995 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR);2996 PGVM pGVM;2997 int rc = GVMMR0ByVMAndEMT(pVM, idCpu, &pGVM);2998 if (RT_FAILURE(rc))2999 return rc;3000 3001 AssertMsgReturn(cPages < RT_BIT(32 - PAGE_SHIFT), ("%#x\n", cPages), VERR_INVALID_PARAMETER);3002 3003 /*3004 * Take the sempahore and do some more validations.3005 */3006 rc = RTSemFastMutexRequest(pGMM->Mtx);3007 AssertRC(rc);3008 if (GMM_CHECK_SANITY_UPON_ENTERING(pGMM))3009 {3010 3011 if (pGVM->gmm.s.cBalloonedPages < cPages)3012 {3013 Assert(pGMM->cBalloonedPages >= pGVM->gmm.s.cBalloonedPages);3014 3015 /*3016 * Record it.3017 */3018 pGMM->cBalloonedPages -= cPages;3019 pGVM->gmm.s.cBalloonedPages -= cPages;3020 if (pGVM->gmm.s.cReqDeflatePages)3021 {3022 Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx Req=%#llx\n", cPages,3023 pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages, pGVM->gmm.s.cReqDeflatePages));3024 3025 /*3026 * Anything we need to do here now when the request has been completed?3027 */3028 pGVM->gmm.s.cReqDeflatePages = 0;3029 }3030 else3031 Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx\n", cPages,3032 pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages));3033 }3034 else3035 {3036 Log(("GMMR0DeflatedBalloon: cBalloonedPages=%#llx cPages=%#x\n", pGVM->gmm.s.cBalloonedPages, cPages));3037 rc = VERR_GMM_ATTEMPT_TO_DEFLATE_TOO_MUCH;3038 }3039 3040 GMM_CHECK_SANITY_UPON_LEAVING(pGMM);3041 }3042 else3043 rc = VERR_INTERNAL_ERROR_5;3044 RTSemFastMutexRelease(pGMM->Mtx);3045 LogFlow(("GMMR0BalloonedPages: returns %Rrc\n", rc));3046 return rc;3047 2991 } 3048 2992
Note:
See TracChangeset
for help on using the changeset viewer.