- Timestamp:
- Jan 28, 2013 12:42:07 PM (12 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r44419 r44421 333 333 #if 0 334 334 /** 335 * Helper class that protects sections of code using the mp VM pointer by335 * Helper class that protects sections of code using the mpUVM pointer by 336 336 * automatically calling addVMCaller() on construction and 337 337 * releaseVMCaller() on destruction. Intended for Console methods dealing 338 * with mp VM. The usage pattern is:338 * with mpUVM. The usage pattern is: 339 339 * <code> 340 340 * AutoVMCaller autoVMCaller(this); 341 341 * if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc(); 342 342 * ... 343 * VMR3ReqCall (mp VM, ...343 * VMR3ReqCall (mpUVM, ... 344 344 * </code> 345 345 * … … 737 737 /** The user mode VM handle. */ 738 738 PUVM mpUVM; 739 /** Holds the number of "readonly" mp VM/mpUVM callers (users)*/739 /** Holds the number of "readonly" mpUVM callers (users). */ 740 740 uint32_t mVMCallers; 741 /** Semaphore posted when the number of mp VM callers drops to zero*/741 /** Semaphore posted when the number of mpUVM callers drops to zero. */ 742 742 RTSEMEVENT mVMZeroCallersSem; 743 /** true when Console has entered the mp VM destruction phase*/743 /** true when Console has entered the mpUVM destruction phase. */ 744 744 bool mVMDestroying : 1; 745 /** true when power down is initiated by vmstateChangeCallback (EMT) */745 /** true when power down is initiated by vmstateChangeCallback (EMT). */ 746 746 bool mVMPoweredOff : 1; 747 747 /** true when vmstateChangeCallback shouldn't initiate a power down. */ -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r44419 r44421 2836 2836 } 2837 2837 2838 /* create a task object early to ensure mpVM protection is successful*/2838 /* Create a task object early to ensure mpUVM protection is successful. */ 2839 2839 std::auto_ptr<VMSaveTask> task(new VMSaveTask(this, pProgress, 2840 2840 stateFilePath, … … 5417 5417 AssertComRCReturnRC(autoCaller.rc()); 5418 5418 5419 /* protect mp VM (if not NULL) */5419 /* protect mpUVM (if not NULL) */ 5420 5420 AutoVMCallerWeak autoVMCaller(this); 5421 if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc(); 5421 if (FAILED(autoVMCaller.rc())) 5422 return autoVMCaller.rc(); 5422 5423 5423 5424 /* Note: validity of mVMMDev which is bound to uninit() is guaranteed by … … 5496 5497 AssertComRCReturnRC(autoCaller.rc()); 5497 5498 5498 /* protect mp VM (if not NULL) */5499 /* protect mpUVM (if not NULL) */ 5499 5500 AutoVMCallerWeak autoVMCaller(this); 5500 if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc(); 5501 if (FAILED(autoVMCaller.rc())) 5502 return autoVMCaller.rc(); 5501 5503 5502 5504 /* Note: validity of mVMMDev which is bound to uninit() is guaranteed by … … 5576 5578 AssertComRCReturnRC(autoCaller.rc()); 5577 5579 5578 /* protect mp VM (if not NULL) */5580 /* protect mpUVM (if not NULL) */ 5579 5581 AutoVMCallerWeak autoVMCaller(this); 5580 if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc(); 5582 if (FAILED(autoVMCaller.rc())) 5583 return autoVMCaller.rc(); 5581 5584 5582 5585 /* Note: validity of mVMMDev which is bound to uninit() is guaranteed by … … 6091 6094 6092 6095 /** 6093 * Increases the usage counter of the mpVM pointer. Guarantees that 6094 * VMR3Destroy() will not be called on it at least until releaseVMCaller() 6095 * is called. 6096 * 6097 * If this method returns a failure, the caller is not allowed to use mpVM 6098 * and may return the failed result code to the upper level. This method sets 6099 * the extended error info on failure if \a aQuiet is false. 6096 * Increases the usage counter of the mpUVM pointer. 6097 * 6098 * Guarantees that VMR3Destroy() will not be called on it at least until 6099 * releaseVMCaller() is called. 6100 * 6101 * If this method returns a failure, the caller is not allowed to use mpUVM and 6102 * may return the failed result code to the upper level. This method sets the 6103 * extended error info on failure if \a aQuiet is false. 6100 6104 * 6101 6105 * Setting \a aQuiet to true is useful for methods that don't want to return 6102 6106 * the failed result code to the caller when this method fails (e.g. need to 6103 * silently check for the mp VM availability).6104 * 6105 * When mp VM is NULL but \a aAllowNullVM is true, a corresponding error will be6107 * silently check for the mpUVM availability). 6108 * 6109 * When mpUVM is NULL but \a aAllowNullVM is true, a corresponding error will be 6106 6110 * returned instead of asserting. Having it false is intended as a sanity check 6107 * for methods that have checked mMachineState and expect mpVM *NOT* to be NULL. 6111 * for methods that have checked mMachineState and expect mpUVM *NOT* to be 6112 * NULL. 6108 6113 * 6109 6114 * @param aQuiet true to suppress setting error info 6110 * @param aAllowNullVM true to accept mp VM being NULL and return a failure6111 * (otherwise this method will assert if mp VM is NULL)6115 * @param aAllowNullVM true to accept mpUVM being NULL and return a failure 6116 * (otherwise this method will assert if mpUVM is NULL) 6112 6117 * 6113 6118 * @note Locks this object for writing. … … 6146 6151 6147 6152 /** 6148 * Decreases the usage counter of the mpVM pointer. Must always complete 6149 * the addVMCaller() call after the mpVM pointer is no more necessary. 6153 * Decreases the usage counter of the mpUVM pointer. 6154 * 6155 * Must always complete the addVMCaller() call after the mpUVM pointer is no 6156 * more necessary. 6150 6157 * 6151 6158 * @note Locks this object for writing. … … 6768 6775 * Calling it in situations other than the above will cause unexpected behavior. 6769 6776 * 6770 * Note that this method should be the only one that destroys mp VM and sets it6777 * Note that this method should be the only one that destroys mpUVM and sets it 6771 6778 * to NULL. 6772 6779 * … … 6875 6882 6876 6883 /* ---------------------------------------------------------------------- 6877 * Now, wait for all mp VM callers to finish their work if there are still6878 * some on other threads. NO methods that need mp VM (or initiate other calls6884 * Now, wait for all mpUVM callers to finish their work if there are still 6885 * some on other threads. NO methods that need mpUVM (or initiate other calls 6879 6886 * that need it) may be called after this point 6880 6887 * ---------------------------------------------------------------------- */ … … 6889 6896 RTSemEventCreate(&mVMZeroCallersSem); 6890 6897 6891 LogFlowThisFunc(("Waiting for mpVM callers (%d) to drop to zero...\n", 6892 mVMCallers)); 6898 LogFlowThisFunc(("Waiting for mpUVM callers (%d) to drop to zero...\n", mVMCallers)); 6893 6899 6894 6900 alock.release(); … … 6969 6975 } 6970 6976 6971 /* Now we've got to destroy the VM as well. (mp VM is not valid beyond6977 /* Now we've got to destroy the VM as well. (mpUVM is not valid beyond 6972 6978 * this point). We release the lock before calling VMR3Destroy() because 6973 6979 * it will result into calling destructors of drivers associated with 6974 6980 * Console children which may in turn try to lock Console (e.g. by 6975 * instantiating SafeVMPtr to access mp VM). It's safe here because6981 * instantiating SafeVMPtr to access mpUVM). It's safe here because 6976 6982 * mVMDestroying is set which should prevent any activity. */ 6977 6983 … … 6997 7003 { 6998 7004 LogFlowThisFunc(("Machine has been destroyed (mMachineState=%d)\n", 6999 7005 mMachineState)); 7000 7006 /* Note: the Console-level machine state change happens on the 7001 7007 * VMSTATE_TERMINATE state change in vmstateChangeCallback(). If … … 7323 7329 * @param aHostPath Shared folder path. 7324 7330 * 7325 * @note Must be called from under AutoVMCaller and when mp VM != NULL!7331 * @note Must be called from under AutoVMCaller and when mpUVM != NULL! 7326 7332 * @note Doesn't lock anything. 7327 7333 */ … … 7435 7441 * @param aName Shared folder name. 7436 7442 * 7437 * @note Must be called from under AutoVMCaller and when mp VM != NULL!7443 * @note Must be called from under AutoVMCaller and when mpUVM != NULL! 7438 7444 * @note Doesn't lock anything. 7439 7445 */ … … 7546 7552 /* Setup task object and thread to carry out the operation 7547 7553 * asynchronously (if we call powerDown() right here but there 7548 * is one or more mp VM callers (added with addVMCaller()) we'll7554 * is one or more mpUVM callers (added with addVMCaller()) we'll 7549 7555 * deadlock). 7550 7556 */ -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r44402 r44421 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 77 77 78 78 #ifdef DEBUG_sunlover 79 static STAMPROFILE StatDisplayRefresh;80 static int stam = 0;79 static STAMPROFILE g_StatDisplayRefresh; 80 static int g_stam = 0; 81 81 #endif /* DEBUG_sunlover */ 82 82 … … 856 856 857 857 #ifdef DEBUG_sunlover 858 if (!stam) 859 { 860 /* protect mpVM */ 861 Console::SafeVMPtr ptrVM (mParent); 862 AssertComRC (ptrVM.rc()); 863 864 STAM_REG(ptrVM.raw(), &StatDisplayRefresh, STAMTYPE_PROFILE, "/PROF/Display/Refresh", STAMUNIT_TICKS_PER_CALL, "Time spent in EMT for display updates."); 865 stam = 1; 858 if (!g_stam) 859 { 860 Console::SafeVMPtr ptrVM(mParent); 861 AssertComRC(ptrVM.rc()); 862 STAMR3RegisterU(ptrVM.rawUVM(), &g_StatDisplayRefresh, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, 863 "/PROF/Display/Refresh", STAMUNIT_TICKS_PER_CALL, "Time spent in EMT for display updates."); 864 g_stam = 1; 866 865 } 867 866 #endif /* DEBUG_sunlover */ … … 3210 3209 3211 3210 #ifdef DEBUG_sunlover 3212 STAM_PROFILE_START(& StatDisplayRefresh, a);3211 STAM_PROFILE_START(&g_StatDisplayRefresh, a); 3213 3212 #endif /* DEBUG_sunlover */ 3214 3213 … … 3349 3348 3350 3349 /* Just return in case of failure without any assertion */ 3351 if (RT_SUCCESS(rc))3350 if (RT_SUCCESS(rc)) 3352 3351 if (RT_SUCCESS(VideoRecDoRGBToYUV(pDisplay->mpVideoRecContext, u32VideoRecImgFormat))) 3353 3352 VideoRecEncodeAndWrite(pDisplay->mpVideoRecContext, ulGuestWidth, ulGuestHeight); … … 3357 3356 3358 3357 #ifdef DEBUG_sunlover 3359 STAM_PROFILE_STOP(& StatDisplayRefresh, a);3358 STAM_PROFILE_STOP(&g_StatDisplayRefresh, a); 3360 3359 #endif /* DEBUG_sunlover */ 3361 3360 #ifdef DEBUG_sunlover_2
Note:
See TracChangeset
for help on using the changeset viewer.