VirtualBox

Changeset 93613 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 6, 2022 4:23:27 AM (3 years ago)
Author:
vboxsync
Message:

Only wake worker after pause/resume if queue enabled by driver

File:
1 edited

Legend:

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

    r93115 r93613  
    15561556        return VINF_SUCCESS;
    15571557
     1558    Log6Func(("[Re]starting %s worker\n", VIRTQNAME(uVirtqNbr)));
    15581559    while (pThread->enmState == PDMTHREADSTATE_RUNNING)
    15591560    {
    1560         if (!pWorkerR3->cRedoDescs && IS_VIRTQ_EMPTY(pDevIns, &pThis->Virtio, uVirtqNbr))
    1561         {
     1561        if (    !pWorkerR3->cRedoDescs
     1562                 && IS_VIRTQ_EMPTY(pDevIns, &pThis->Virtio, uVirtqNbr))        {
    15621563            /* Atomic interlocks avoid missing alarm while going to sleep & notifier waking the awoken */
    15631564            ASMAtomicWriteBool(&pWorker->fSleeping, true);
     
    15701571                AssertLogRelMsgReturn(RT_SUCCESS(rc) || rc == VERR_INTERRUPTED, ("%Rrc\n", rc), rc);
    15711572                if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING))
     1573                        {
     1574                    Log6Func(("%s worker thread not running, exiting\n", VIRTQNAME(uVirtqNbr)));
    15721575                    return VINF_SUCCESS;
     1576                }
    15731577                if (rc == VERR_INTERRUPTED)
     1578                {
     1579                    Log6Func(("%s worker interrupted ... continuing\n", VIRTQNAME(uVirtqNbr)));
    15741580                    continue;
     1581                }
    15751582                Log6Func(("%s worker woken\n", VIRTQNAME(uVirtqNbr)));
    15761583                ASMAtomicWriteBool(&pWorker->fNotified, false);
    15771584            }
    15781585            ASMAtomicWriteBool(&pWorker->fSleeping, false);
     1586        }
     1587        if (!virtioCoreIsVirtqEnabled(&pThis->Virtio, uVirtqNbr))
     1588        {
     1589            LogFunc(("%s queue not enabled, worker aborting...\n", VIRTQNAME(uVirtqNbr)));
     1590            break;
    15791591        }
    15801592
     
    22942306    for (uint16_t uVirtqNbr = 0; uVirtqNbr < VIRTIOSCSI_REQ_VIRTQ_CNT; uVirtqNbr++)
    22952307    {
    2296         if (ASMAtomicReadBool(&pThis->aWorkers[uVirtqNbr].fSleeping))
     2308        if (   virtioCoreIsVirtqEnabled(&pThis->Virtio, uVirtqNbr)
     2309            && ASMAtomicReadBool(&pThis->aWorkers[uVirtqNbr].fSleeping))
    22972310        {
    22982311            Log6Func(("waking %s worker.\n", VIRTQNAME(uVirtqNbr)));
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