Changeset 2565 in vbox for trunk/src/VBox
- Timestamp:
- May 9, 2007 4:28:03 PM (18 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r2544 r2565 339 339 /** The position at which to get a new request for the AIO thread. */ 340 340 uint8_t AsyncIOReqTail; 341 uint8_t Alignment3[2]; /** Explicit padding of the 2 byte gap. */341 uint8_t Alignment3[2]; /**< Explicit padding of the 2 byte gap. */ 342 342 /** Magic delay before triggering interrupts in DMA mode. */ 343 343 uint32_t DelayIRQMillies; … … 597 597 rc = RTSemMutexRelease(pCtl->AsyncIORequestMutex); 598 598 AssertRC(rc); 599 rc = RTSemEventSignal(pCtl->AsyncIOSem); 600 AssertRC(rc); 599 LogBird(("ata: %x: signalling\n", pCtl->IOPortBase1)); 600 rc = PDMR3CritSectScheduleExitEvent(&pCtl->lock, pCtl->AsyncIOSem); 601 if (VBOX_FAILURE(rc)) 602 { 603 LogBird(("ata: %x: schedule failed, rc=%Vrc\n", pCtl->IOPortBase1, rc)); 604 rc = RTSemEventSignal(pCtl->AsyncIOSem); 605 AssertRC(rc); 606 } 601 607 } 602 608 … … 3990 3996 if (pReq == NULL) 3991 3997 { 3998 LogBird(("ata: %x: going to sleep...\n", pCtl->IOPortBase1)); 3992 3999 rc = RTSemEventWait(pCtl->AsyncIOSem, RT_INDEFINITE_WAIT); 4000 LogBird(("ata: %x: waking up\n", pCtl->IOPortBase1)); 3993 4001 if (VBOX_FAILURE(rc) || pCtl->fShutdown) 3994 4002 break; … … 4020 4028 { 4021 4029 STAM_PROFILE_START(&pCtl->StatLockWait, a); 4030 LogBird(("ata: %x: entering critsect\n", pCtl->IOPortBase1)); 4022 4031 PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); 4032 LogBird(("ata: %x: entered\n", pCtl->IOPortBase1)); 4023 4033 STAM_PROFILE_STOP(&pCtl->StatLockWait, a); 4024 4034 } … … 4358 4368 } 4359 4369 4370 LogBird(("ata: %x: leaving critsect\n", pCtl->IOPortBase1)); 4360 4371 PDMCritSectLeave(&pCtl->lock); 4361 4372 } … … 4740 4751 else 4741 4752 AssertMsgFailed(("ataIOPortWrite1: unsupported write to port %x val=%x size=%d\n", Port, u32, cb)); 4753 LogBird(("ata: leaving critsect\n")); 4742 4754 PDMCritSectLeave(&pCtl->lock); 4755 LogBird(("ata: left critsect\n")); 4743 4756 return rc; 4744 4757 } -
trunk/src/VBox/VMM/PDMCritSect.cpp
r634 r2565 119 119 pCritSect->pVMGC = pVM->pVMGC; 120 120 pCritSect->pvKey = pvKey; 121 pCritSect->EventToSignal = NIL_RTSEMEVENT; 121 122 pCritSect->pNext = pVM->pdm.s.pCritSects; 122 123 pVM->pdm.s.pCritSects = pCritSect; … … 323 324 } 324 325 326 327 /** 328 * Schedule a event semaphore for signalling upon critsect exit. 329 * 330 * @returns VINF_SUCCESS on success. 331 * @returns VERR_TOO_MANY_SEMAPHORES if an event was already scheduled. 332 * @returns VERR_NOT_OWNER if we're not the critsect owner. 333 * @returns VERR_SEM_DESTROYED if RTCritSectDelete was called while waiting. 334 * @param pCritSect The critical section. 335 * @param EventToSignal The semapore that should be signalled. 336 */ 337 PDMR3DECL(int) PDMR3CritSectScheduleExitEvent(PPDMCRITSECT pCritSect, RTSEMEVENT EventToSignal) 338 { 339 Assert(EventToSignal != NIL_RTSEMEVENT); 340 if (RT_UNLIKELY(!RTCritSectIsOwner(&pCritSect->s.Core))) 341 return VERR_NOT_OWNER; 342 if (RT_LIKELY( pCritSect->s.EventToSignal == NIL_RTSEMEVENT 343 || pCritSect->s.EventToSignal == EventToSignal)) 344 { 345 pCritSect->s.EventToSignal = EventToSignal; 346 return VINF_SUCCESS; 347 } 348 return VERR_TOO_MANY_SEMAPHORES; 349 } 350 -
trunk/src/VBox/VMM/PDMInternal.h
r1447 r2565 146 146 /** Pointer to the VM - GCPtr. */ 147 147 GCPTRTYPE(PVM) pVMGC; 148 #if GC_ARCH_BITS == 32 149 uint32_t u32Padding; 150 #endif 148 #if HC_ARCH_BITS == 64 && GC_ARCH_BITS == 32 149 uint32_t padding; 150 #endif 151 /** Event semaphore that is scheduled to be signaled upon leaving the 152 * critical section. This is Ring-3 only of course. */ 153 RTSEMEVENT EventToSignal; 151 154 /** R0/GC lock contention. */ 152 155 STAMCOUNTER StatContentionR0GCLock; -
trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
r23 r2565 34 34 #include <iprt/asm.h> 35 35 #include <iprt/assert.h> 36 #ifdef IN_RING3 37 # include <iprt/semaphore.h> 38 #endif 36 39 37 40 … … 107 110 STAM_PROFILE_ADV_STOP(&pCritSect->s.StatLocked, l); 108 111 # endif 109 int rc = RTCritSectLeave(&pCritSect->s.Core); 110 AssertRC(rc); 112 RTSEMEVENT EventToSignal = pCritSect->s.EventToSignal; 113 if (RT_LIKELY(EventToSignal == NIL_RTSEMEVENT)) 114 { 115 int rc = RTCritSectLeave(&pCritSect->s.Core); 116 AssertRC(rc); 117 } 118 else 119 { 120 pCritSect->s.EventToSignal = NIL_RTSEMEVENT; 121 int rc = RTCritSectLeave(&pCritSect->s.Core); 122 AssertRC(rc); 123 LogBird(("signalling %#x\n", EventToSignal)); 124 rc = RTSemEventSignal(EventToSignal); 125 AssertRC(rc); 126 } 111 127 112 #else 128 #else /* !IN_RING3 */ 113 129 Assert(VALID_PTR(pCritSect)); 114 130 Assert(pCritSect->s.Core.u32Magic == RTCRITSECT_MAGIC);
Note:
See TracChangeset
for help on using the changeset viewer.