Changeset 50385 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Feb 10, 2014 11:07:05 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/TMAll.cpp
r50383 r50385 71 71 #else 72 72 # define TMTIMER_ASSERT_CRITSECT(pTimer) do { } while (0) 73 #endif 74 75 /** @def TMTIMER_ASSERT_SYNC_CRITSECT_ORDER 76 * Checks for lock order trouble between the timer critsect and the critical 77 * section critsect. The virtual sync critsect must always be entered before 78 * the one associated with the timer (see TMR3TimerQueuesDo). It is OK if there 79 * isn't any critical section associated with the timer or if the calling thread 80 * doesn't own it, ASSUMING of course that the thread using this macro is going 81 * to enter the virtual sync critical section anyway. 82 * 83 * @remarks This is a sligtly relaxed timer locking attitude compared to 84 * TMTIMER_ASSERT_CRITSECT, however, the calling device/whatever code 85 * should know what it's doing if it's stopping or starting a timer 86 * without taking the device lock. 87 */ 88 #ifdef VBOX_STRICT 89 # define TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer) \ 90 do { \ 91 if ((pTimer)->pCritSect) \ 92 { \ 93 VMSTATE enmState; \ 94 PPDMCRITSECT pCritSect = (PPDMCRITSECT)MMHyperR3ToCC(pVM, (pTimer)->pCritSect); \ 95 AssertMsg( pCritSect \ 96 && ( !PDMCritSectIsOwner(pCritSect) \ 97 || PDMCritSectIsOwner(&pVM->tm.s.VirtualSyncLock) \ 98 || (enmState = (pVM)->enmVMState) == VMSTATE_CREATING \ 99 || enmState == VMSTATE_RESETTING \ 100 || enmState == VMSTATE_RESETTING_LS ),\ 101 ("pTimer=%p (%s) pCritSect=%p (%s)\n", pTimer, R3STRING(pTimer->pszDesc), \ 102 (pTimer)->pCritSect, R3STRING(PDMR3CritSectName((pTimer)->pCritSect)) )); \ 103 } \ 104 } while (0) 105 #else 106 # define TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pTimer) do { } while (0) 73 107 #endif 74 108 … … 1130 1164 STAM_PROFILE_START(&pVM->tm.s.CTX_SUFF_Z(StatTimerSetVs), a); 1131 1165 VM_ASSERT_EMT(pVM); 1166 TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer); 1132 1167 int rc = PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VINF_SUCCESS); 1133 1168 AssertRCReturn(rc, rc); … … 1428 1463 STAM_PROFILE_START(pVM->tm.s.CTX_SUFF_Z(StatTimerSetRelativeVs), a); 1429 1464 VM_ASSERT_EMT(pVM); 1430 Assert(PDMCritSectIsOwner(&pVM->tm.s.VirtualSyncLock));1465 TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer); 1431 1466 int rc = PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VINF_SUCCESS); 1432 1467 AssertRCReturn(rc, rc); … … 1755 1790 STAM_PROFILE_START(&pVM->tm.s.CTX_SUFF_Z(StatTimerStopVs), a); 1756 1791 VM_ASSERT_EMT(pVM); 1792 TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer); 1757 1793 int rc = PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VINF_SUCCESS); 1758 1794 AssertRCReturn(rc, rc);
Note:
See TracChangeset
for help on using the changeset viewer.