Changeset 90531 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 5, 2021 8:54:46 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 146137
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
r90515 r90531 114 114 DECL_FORCE_INLINE(int) pdmCritSectEnterFirst(PPDMCRITSECT pCritSect, RTNATIVETHREAD hNativeSelf, PCRTLOCKVALSRCPOS pSrcPos) 115 115 { 116 Assert(hNativeSelf != NIL_RTNATIVETHREAD); 116 117 AssertMsg(pCritSect->s.Core.NativeThreadOwner == NIL_RTNATIVETHREAD, ("NativeThreadOwner=%p\n", pCritSect->s.Core.NativeThreadOwner)); 117 118 Assert(!(pCritSect->s.Core.fFlags & PDMCRITSECT_FLAGS_PENDING_UNLOCK)); … … 130 131 NOREF(pSrcPos); 131 132 # endif 133 if (pSrcPos) 134 Log12Func(("%p: uId=%p ln=%u fn=%s\n", pCritSect, pSrcPos->uId, pSrcPos->uLine, pSrcPos->pszFunction)); 135 else 136 Log12Func(("%p\n", pCritSect)); 132 137 133 138 STAM_PROFILE_ADV_START(&pCritSect->s.StatLocked, l); … … 154 159 PCRTLOCKVALSRCPOS pSrcPos, int rcBusy) 155 160 { 161 # ifdef IN_RING0 162 /* 163 * If we've got queued critical section leave operations and rcBusy isn't 164 * VINF_SUCCESS, return to ring-3 immediately to avoid deadlocks. 165 */ 166 if ( !pVCpu 167 || !VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PDM_CRITSECT) 168 || rcBusy == VINF_SUCCESS ) 169 { /* likely */ } 170 else 171 { 172 /** @todo statistics. */ 173 STAM_REL_COUNTER_INC(&pCritSect->s.StatContentionRZLock); 174 return rcBusy; 175 } 176 # endif 177 156 178 /* 157 179 * Start waiting. … … 221 243 ? SUPSemEventWaitNoResume(pSession, hEvent, cMsMaxOne) 222 244 : SUPSemEventWait(pSession, hEvent, cMsMaxOne); 245 Log11Func(("%p: rc=%Rrc %'RU64 ns (cMsMaxOne=%RU64 hOwner=%p)\n", 246 pCritSect, rc, RTTimeNanoTS() - tsStart, cMsMaxOne, pCritSect->s.Core.NativeThreadOwner)); 223 247 # endif /* IN_RING0 */ 224 248 … … 319 343 } 320 344 cCmpXchgs++; 345 if ((cCmpXchgs & 0xffff) == 0) 346 Log11Func(("%p: cLockers=%d cCmpXchgs=%u (hOwner=%p)\n", 347 pCritSect, cLockers, cCmpXchgs, pCritSect->s.Core.NativeThreadOwner)); 321 348 ASMNopPause(); 322 349 continue; … … 446 473 # endif 447 474 ASMAtomicIncS32(&pCritSect->s.Core.cLockers); 475 Log12Func(("%p: cNestings=%d cLockers=%d\n", pCritSect, pCritSect->s.Core.cNestings, pCritSect->s.Core.cLockers)); 448 476 return VINF_SUCCESS; 449 477 } … … 654 682 # endif 655 683 ASMAtomicIncS32(&pCritSect->s.Core.cLockers); 684 Log12Func(("%p: cNestings=%d cLockers=%d\n", pCritSect, pCritSect->s.Core.cNestings, pCritSect->s.Core.cLockers)); 656 685 return VINF_SUCCESS; 657 686 } … … 781 810 */ 782 811 RTNATIVETHREAD const hNativeSelf = pdmCritSectGetNativeSelf(pVM, pCritSect); 783 VMM_ASSERT_RELEASE_MSG_RETURN(pVM, pCritSect->s.Core.NativeThreadOwner == hNativeSelf || hNativeSelf == NIL_RTNATIVETHREAD,812 VMM_ASSERT_RELEASE_MSG_RETURN(pVM, pCritSect->s.Core.NativeThreadOwner == hNativeSelf && hNativeSelf != NIL_RTNATIVETHREAD, 784 813 ("%p %s: %p != %p; cLockers=%d cNestings=%d\n", pCritSect, R3STRING(pCritSect->s.pszName), 785 814 pCritSect->s.Core.NativeThreadOwner, hNativeSelf, … … 799 828 ASMAtomicWriteS32(&pCritSect->s.Core.cNestings, cNestings - 1); 800 829 #endif 801 ASMAtomicDecS32(&pCritSect->s.Core.cLockers); 802 Assert(pCritSect->s.Core.cLockers >= 0); 830 int32_t const cLockers = ASMAtomicDecS32(&pCritSect->s.Core.cLockers); 831 Assert(cLockers >= 0); RT_NOREF(cLockers); 832 Log12Func(("%p: cNestings=%d cLockers=%d\n", pCritSect, cNestings - 1, cLockers)); 803 833 return VINF_SEM_NESTED; 804 834 } 805 835 836 Log12Func(("%p: cNestings=%d cLockers=%d hOwner=%p - leave for real\n", 837 pCritSect, cNestings, pCritSect->s.Core.cLockers, pCritSect->s.Core.NativeThreadOwner)); 806 838 807 839 #ifdef IN_RING3 … … 839 871 /* Someone is waiting, wake up one of them. */ 840 872 Assert(cLockers < _8K); 873 Log8(("PDMCritSectLeave: Waking up %p (cLockers=%u)\n", pCritSect, cLockers)); 841 874 SUPSEMEVENT hEvent = (SUPSEMEVENT)pCritSect->s.Core.EventSem; 842 875 int rc = SUPSemEventSignal(pVM->pSession, hEvent); … … 849 882 else 850 883 { 851 Log8((" Signalling %#p\n", hEventToSignal));884 Log8(("PDMCritSectLeave: Signalling %#p (%p)\n", hEventToSignal, pCritSect)); 852 885 int rc = SUPSemEventSignal(pVM->pSession, hEventToSignal); 853 886 AssertRC(rc);
Note:
See TracChangeset
for help on using the changeset viewer.