VirtualBox

Changeset 81413 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Oct 21, 2019 1:39:27 PM (5 years ago)
Author:
vboxsync
Message:

PDMR3Task: execution thread fix. bugref:9218

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PDMR3Task.cpp

    r81409 r81413  
    110110        pTaskSet->idxRunning    = UINT8_MAX;
    111111        //pTaskSet->fShutdown   = false;
     112        pTaskSet->pVM           = pVM;
    112113
    113114        pVM->pdm.s.apTaskSets[i] = pTaskSet;
     
    222223        {
    223224            uint64_t fTriggered = ASMAtomicReadU64(&pTaskSet->fTriggered);
    224             unsigned iTask;
    225             while ( (iTask = ASMBitFirstSetU64(fTriggered)) != 0)
     225            unsigned iTask      = ASMBitFirstSetU64(fTriggered);
     226            if (iTask == 0)
     227                break;
     228            do
    226229            {
    227230                iTask--;
    228231                AssertBreak(iTask < RT_ELEMENTS(pTaskSet->aTasks));
    229232
    230                 fTriggered &= ~RT_BIT_64(iTask);
    231233                if (ASMAtomicBitTestAndClear(&pTaskSet->fTriggered, iTask))
    232234                {
     
    276278                    ASMAtomicWriteU32(&pTaskSet->idxRunning, UINT32_MAX);
    277279                }
    278             }
     280
     281                /* Next pending task. */
     282                fTriggered &= ~RT_BIT_64(iTask);
     283                iTask = ASMBitFirstSetU64(fTriggered);
     284            } while (iTask != 0);
    279285        }
     286
     287        /*
     288         * Wait.
     289         */
     290        if (pTaskSet->fRZEnabled)
     291            SUPSemEventWaitNoResume(pTaskSet->pVM->pSession, pTaskSet->hEventR0, RT_MS_15SEC);
     292        else
     293            RTSemEventWaitNoResume(pTaskSet->hEventR3, RT_MS_15SEC);
    280294    }
    281295
     
    386400                pTaskSet->idxRunning    = UINT8_MAX;
    387401                //pTaskSet->fShutdown   = false;
     402                pTaskSet->pVM           = pVM;
    388403
    389404                pVM->pdm.s.apTaskSets[i] = pTaskSet;
     
    400415    if (pTaskSet->hThread == NIL_RTTHREAD)
    401416    {
    402         int rc = RTThreadCreateF(&pTaskSet->hThread, pdmR3TaskThread,  pTaskSet, 0 /*cbStack*/, RTTHREADTYPE_IO,
     417        int rc = RTThreadCreateF(&pTaskSet->hThread, pdmR3TaskThread, pTaskSet, 0 /*cbStack*/, RTTHREADTYPE_IO,
    403418                                 RTTHREADFLAGS_WAITABLE, "TaskSet%u", pTaskSet->uHandleBase / RT_ELEMENTS(pTaskSet->aTasks));
    404419        AssertLogRelRCReturn(rc, rc);
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r81391 r81413  
    10261026    /** Event semaphore for waking up the thread when fRZEnabled is clear. */
    10271027    R3PTRTYPE(RTSEMEVENT)   hEventR3;
     1028    /** The VM pointer.   */
     1029    PVM                     pVM;
    10281030    /** Padding so fTriggered is in its own cacheline. */
    1029     uint64_t                au64Padding2[4];
     1031    uint64_t                au64Padding2[3];
    10301032
    10311033    /** Bitmask of triggered tasks. */
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