VirtualBox

Changeset 53341 in vbox for trunk


Ignore:
Timestamp:
Nov 17, 2014 3:56:12 PM (10 years ago)
Author:
vboxsync
Message:

Devices/DevLsiLogic: Fixed a Guru meditation under certain conditions in raw mode. The worker thread runs independent from EMT and can force the raw context to create wakeup events even if the worker thread is not sleeping.

Location:
trunk/src/VBox/Devices/Storage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevBusLogic.cpp

    r52713 r53341  
    22382238            {
    22392239                /* If there are no mailboxes configured, don't even try to do anything. */
    2240                 if (pBusLogic->cMailbox) {
     2240                if (pBusLogic->cMailbox)
     2241                {
    22412242                    ASMAtomicIncU32(&pBusLogic->cMailboxesReady);
    22422243                    if (!ASMAtomicXchgBool(&pBusLogic->fNotificationSend, true))
  • trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp

    r51516 r53341  
    194194    bool                 fDiagnosticEnabled;
    195195    /** Flag whether a notification was send to R3. */
    196     bool                 fNotificationSend;
     196    bool                 fNotificationSent;
    197197    /** Flag whether the guest enabled event notification from the IOC. */
    198198    bool                 fEventNotificationEnabled;
     
    12831283            ASMAtomicWriteU32(&pThis->uRequestQueueNextEntryFreeWrite, uNextWrite);
    12841284
    1285             /* Send notification to R3 if there is not one send already. */
    1286             if (!ASMAtomicXchgBool(&pThis->fNotificationSend, true))
     1285            /* Send notification to R3 if there is not one sent already. Do this
     1286             * only if the worker thread is not sleeping or might go sleeping. */
     1287            if (ASMAtomicReadBool(&pThis->fWrkThreadSleeping))
    12871288            {
     1289                if (!ASMAtomicXchgBool(&pThis->fNotificationSent, true))
     1290                {
    12881291#ifdef IN_RC
    1289                 PPDMQUEUEITEMCORE pNotificationItem = PDMQueueAlloc(pThis->CTX_SUFF(pNotificationQueue));
    1290                 AssertPtr(pNotificationItem);
    1291 
    1292                 PDMQueueInsert(pThis->CTX_SUFF(pNotificationQueue), pNotificationItem);
     1292                    PPDMQUEUEITEMCORE pNotificationItem = PDMQueueAlloc(pThis->CTX_SUFF(pNotificationQueue));
     1293                    AssertPtr(pNotificationItem);
     1294                    PDMQueueInsert(pThis->CTX_SUFF(pNotificationQueue), pNotificationItem);
    12931295#else
    1294                 LogFlowFunc(("Signal event semaphore\n"));
    1295                 int rc = SUPSemEventSignal(pThis->pSupDrvSession, pThis->hEvtProcess);
    1296                 AssertRC(rc);
     1296                    LogFlowFunc(("Signal event semaphore\n"));
     1297                    int rc = SUPSemEventSignal(pThis->pSupDrvSession, pThis->hEvtProcess);
     1298                    AssertRC(rc);
    12971299#endif
     1300                }
    12981301            }
    12991302            break;
     
    40394042    pHlp->pfnPrintf(pHlp, "enmDoorbellState=%d\n", pThis->enmDoorbellState);
    40404043    pHlp->pfnPrintf(pHlp, "fDiagnosticEnabled=%RTbool\n", pThis->fDiagnosticEnabled);
    4041     pHlp->pfnPrintf(pHlp, "fNotificationSend=%RTbool\n", pThis->fNotificationSend);
     4044    pHlp->pfnPrintf(pHlp, "fNotificationSent=%RTbool\n", pThis->fNotificationSent);
    40424045    pHlp->pfnPrintf(pHlp, "fEventNotificationEnabled=%RTbool\n", pThis->fEventNotificationEnabled);
    40434046    pHlp->pfnPrintf(pHlp, "uInterruptMask=%#x\n", pThis->uInterruptMask);
     
    41644167    while (pThread->enmState == PDMTHREADSTATE_RUNNING)
    41654168    {
    4166         bool fNotificationSend;
    4167 
    41684169        ASMAtomicWriteBool(&pThis->fWrkThreadSleeping, true);
    4169         fNotificationSend = ASMAtomicXchgBool(&pThis->fNotificationSend, false);
    4170         if (!fNotificationSend)
     4170        bool fNotificationSent = ASMAtomicXchgBool(&pThis->fNotificationSent, false);
     4171        if (!fNotificationSent)
    41714172        {
    41724173            Assert(ASMAtomicReadBool(&pThis->fWrkThreadSleeping));
     
    41764177                break;
    41774178            LogFlowFunc(("Woken up with rc=%Rrc\n", rc));
    4178             fNotificationSend = ASMAtomicXchgBool(&pThis->fNotificationSend, false);
     4179            ASMAtomicWriteBool(&pThis->fNotificationSent, false);
    41794180        }
    41804181
     
    42994300static void lsilogicR3Kick(PLSILOGICSCSI pThis)
    43004301{
    4301     if (pThis->fNotificationSend)
     4302    if (pThis->fNotificationSent)
    43024303    {
    43034304        /* Send a notifier to the PDM queue that there are pending requests. */
     
    43604361    SSMR3PutU32   (pSSM, pThis->enmDoorbellState);
    43614362    SSMR3PutBool  (pSSM, pThis->fDiagnosticEnabled);
    4362     SSMR3PutBool  (pSSM, pThis->fNotificationSend);
     4363    SSMR3PutBool  (pSSM, pThis->fNotificationSent);
    43634364    SSMR3PutBool  (pSSM, pThis->fEventNotificationEnabled);
    43644365    SSMR3PutU32   (pSSM, pThis->uInterruptMask);
     
    46014602        SSMR3GetU32(pSSM, (uint32_t *)&pThis->enmDoorbellState);
    46024603    SSMR3GetBool  (pSSM, &pThis->fDiagnosticEnabled);
    4603     SSMR3GetBool  (pSSM, &pThis->fNotificationSend);
     4604    SSMR3GetBool  (pSSM, &pThis->fNotificationSent);
    46044605    SSMR3GetBool  (pSSM, &pThis->fEventNotificationEnabled);
    46054606    SSMR3GetU32   (pSSM, (uint32_t *)&pThis->uInterruptMask);
     
    49964997        ASMAtomicWriteBool(&pThis->fSignalIdle, false);
    49974998
    4998         AssertMsg(!pThis->fNotificationSend, ("The PDM Queue should be empty at this point\n"));
     4999        AssertMsg(!pThis->fNotificationSent, ("The PDM Queue should be empty at this point\n"));
    49995000
    50005001        if (pThis->fRedo)
     
    50235024                    pThis->uRequestQueueNextEntryFreeWrite %= pThis->cRequestQueueEntries;
    50245025
    5025                     pThis->fNotificationSend = true;
     5026                    pThis->fNotificationSent = true;
    50265027                }
    50275028                else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette