VirtualBox

Changeset 60015 in vbox


Ignore:
Timestamp:
Mar 14, 2016 9:37:22 AM (9 years ago)
Author:
vboxsync
Message:

LsiLogic: Process requests from the BIOS on the worker thread and not on EMT because this breaks with disk encryption when setting the runtime error about missing DEKs @bugref{8277}

File:
1 edited

Legend:

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

    r59252 r60015  
    341341    /** Flag whether the worker thread is sleeping. */
    342342    volatile bool                    fWrkThreadSleeping;
     343    /** Flag whether a request from the BIOS is pending which the
     344     * worker thread needs to process. */
     345    volatile bool                    fBiosReqPending;
     346#if HC_ARCH_BITS == 64
    343347    /** Alignment padding. */
    344     bool                             afPadding2[HC_ARCH_BITS == 32 ? 1 : 5];
     348    bool                             afPadding2[4];
     349#endif
    345350    /** List of tasks which can be redone. */
    346351    R3PTRTYPE(volatile PLSILOGICREQ) pTasksRedoHead;
     
    21432148        lsilogicR3WarningISCSI(pThis->CTX_SUFF(pDevIns));
    21442149    }
    2145     else
     2150    else if (rc != VERR_VD_DEK_MISSING)
    21462151        lsilogicR3WarningUnknown(pThis->CTX_SUFF(pDevIns), rc);
    21472152}
     
    38363841    Assert(cb == 1);
    38373842
     3843    /*
     3844     * If there is already a request form the BIOS pending ignore this write
     3845     * because it should not happen.
     3846     */
     3847    if (ASMAtomicReadBool(&pThis->fBiosReqPending))
     3848        return VINF_SUCCESS;
     3849
    38383850    uint8_t iRegister = pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI
    38393851                      ? Port - LSILOGIC_BIOS_IO_PORT
     
    38423854    if (rc == VERR_MORE_DATA)
    38433855    {
    3844         rc = lsilogicR3PrepareBiosScsiRequest(pThis);
    3845         AssertRC(rc);
     3856        ASMAtomicXchgBool(&pThis->fBiosReqPending, true);
     3857        /* Send a notifier to the PDM queue that there are pending requests. */
     3858        PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pNotificationQueue));
     3859        AssertMsg(pItem, ("Allocating item for queue failed\n"));
     3860        PDMQueueInsert(pThis->CTX_SUFF(pNotificationQueue), (PPDMQUEUEITEMCORE)pItem);
    38463861    }
    38473862    else if (RT_FAILURE(rc))
     
    41834198
    41844199        ASMAtomicWriteBool(&pThis->fWrkThreadSleeping, false);
     4200
     4201        /* Check whether there is a BIOS request pending and process it first. */
     4202        if (ASMAtomicReadBool(&pThis->fBiosReqPending))
     4203        {
     4204            rc = lsilogicR3PrepareBiosScsiRequest(pThis);
     4205            AssertRC(rc);
     4206            ASMAtomicXchgBool(&pThis->fBiosReqPending, false);
     4207        }
    41854208
    41864209        /* Only process request which arrived before we received the notification. */
     
    43024325static void lsilogicR3Kick(PLSILOGICSCSI pThis)
    43034326{
     4327    if (   pThis->VBoxSCSI.fBusy
     4328        && !pThis->fBiosReqPending)
     4329        pThis->fBiosReqPending = true;
     4330
    43044331    if (pThis->fNotificationSent)
    43054332    {
     
    43094336        PDMQueueInsert(pThis->CTX_SUFF(pNotificationQueue), (PPDMQUEUEITEMCORE)pItem);
    43104337    }
    4311     else if (pThis->VBoxSCSI.fBusy)
    4312     {
    4313         /* The BIOS had a request active when we got suspended. Resume it. */
    4314         int rc = lsilogicR3PrepareBiosScsiRequest(pThis);
    4315         AssertRC(rc);
    4316     }
    4317 
    43184338}
    43194339
     
    49975017                    pThis->uRequestQueueNextEntryFreeWrite++;
    49985018                    pThis->uRequestQueueNextEntryFreeWrite %= pThis->cRequestQueueEntries;
    4999 
    5000                     pThis->fNotificationSent = true;
    50015019                }
    50025020                else
     
    50065024                }
    50075025
     5026                pThis->fNotificationSent = true;
     5027
    50085028                pFree = pLsiReq;
    50095029                pLsiReq = pLsiReq->pRedoNext;
     
    52275247    pThis->hTaskCache  = NIL_RTMEMCACHE;
    52285248    pThis->hEvtProcess = NIL_SUPSEMEVENT;
     5249    pThis->fBiosReqPending = false;
    52295250    RTListInit(&pThis->ListMemRegns);
    52305251
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