Changeset 30975 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jul 22, 2010 9:19:17 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r30947 r30975 957 957 case LSILOGIC_REG_REQUEST_QUEUE: 958 958 { 959 ASMAtomicWriteU32(&pThis->CTX_SUFF(pRequestQueueBase)[pThis->uRequestQueueNextEntryFreeWrite], u32); 960 pThis->uRequestQueueNextEntryFreeWrite++; 961 pThis->uRequestQueueNextEntryFreeWrite %= pThis->cRequestQueueEntries; 959 uint32_t uNextWrite = ASMAtomicReadU32(&pThis->uRequestQueueNextEntryFreeWrite); 960 961 ASMAtomicWriteU32(&pThis->CTX_SUFF(pRequestQueueBase)[uNextWrite], u32); 962 963 /* 964 * Don't update the value in place. It can happen that we get preempted 965 * after the increment but before the modulo. 966 * Another EMT will read the wrong value when processing the queues 967 * and hang in an endless loop creating thousands of requests. 968 */ 969 uNextWrite++; 970 uNextWrite %= pThis->cRequestQueueEntries; 971 ASMAtomicWriteU32(&pThis->uRequestQueueNextEntryFreeWrite, uNextWrite); 962 972 963 973 /* Send notification to R3 if there is not one send already. */ … … 3422 3432 LogFlowFunc(("pDevIns=%#p pItem=%#p\n", pDevIns, pItem)); 3423 3433 3434 /* Reset notification event. */ 3435 ASMAtomicXchgBool(&pLsiLogic->fNotificationSend, false); 3436 3424 3437 /* Only process request which arrived before we received the notification. */ 3425 3438 uint32_t uRequestQueueNextEntryWrite = ASMAtomicReadU32(&pLsiLogic->uRequestQueueNextEntryFreeWrite); 3426 3427 /* Reset notification event. */3428 ASMAtomicXchgBool(&pLsiLogic->fNotificationSend, false);3429 3439 3430 3440 /* Go through the messages now and process them. */
Note:
See TracChangeset
for help on using the changeset viewer.