VirtualBox

Changeset 19420 in vbox


Ignore:
Timestamp:
May 6, 2009 11:07:11 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
46945
Message:

Action flag updates

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vm.h

    r19403 r19420  
    203203#define VM_FF_TIMER                         RT_BIT_32(2)
    204204/** PDM Queues are pending. */
    205 #define VM_FF_PDM_QUEUES                    RT_BIT_32(3)
     205#define VM_FF_PDM_QUEUES_BIT                3
     206#define VM_FF_PDM_QUEUES                    RT_BIT_32(VM_FF_PDM_QUEUES_BIT)
    206207/** PDM DMA transfers are pending. */
    207 #define VM_FF_PDM_DMA                       RT_BIT_32(4)
     208#define VM_FF_PDM_DMA_BIT                   4
     209#define VM_FF_PDM_DMA                       RT_BIT_32(VM_FF_PDM_DMA_BIT)
    208210/** PDM critical section unlocking is pending, process promptly upon return to R3. */
    209211#define VM_FF_PDM_CRITSECT                  RT_BIT_32(5)
     
    390392#define VM_FF_ISPENDING(pVM, fFlags)        ((pVM)->fGlobalForcedActions & (fFlags))
    391393
     394/** @def VM_FF_TESTANDCLEAR
     395 * Checks if one (!) force action in the specified set is pending and clears it atomically
     396 *
     397 * @returns true if the bit was set.
     398 * @returns false if the bit was clear.
     399 * @param   pVM     VM Handle.
     400 * @param   iBit    Bit position to check and clear
     401 */
     402#define VM_FF_TESTANDCLEAR(pVM, iBit)        (ASMBitTestAndClear(&(pVM)->fGlobalForcedActions, iBit))
     403
    392404/** @def VMCPU_FF_ISPENDING
    393405 * Checks if one or more force action in the specified set is pending for the given VCPU.
  • trunk/src/VBox/VMM/EM.cpp

    r19414 r19420  
    967967             * imporant FFs while we were busy switching the state. So, check again.
    968968             */
    969             if (VM_FF_ISPENDING(pVM, VM_FF_REQUEST | VM_FF_TIMER | VM_FF_PDM_QUEUES | VM_FF_DBGF | VM_FF_TERMINATE | VM_FF_RESET))
     969            if (    VM_FF_ISPENDING(pVM, VM_FF_REQUEST | VM_FF_TIMER | VM_FF_PDM_QUEUES | VM_FF_DBGF | VM_FF_TERMINATE | VM_FF_RESET)
     970                ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_REQUEST))
    970971            {
    971972                LogFlow(("emR3RemExecute: Skipping run, because FF is set. %#x\n", pVM->fGlobalForcedActions));
  • trunk/src/VBox/VMM/PDM.cpp

    r19141 r19420  
    13301330VMMR3DECL(void) PDMR3DmaRun(PVM pVM)
    13311331{
    1332     VM_FF_CLEAR(pVM, VM_FF_PDM_DMA);
    1333     if (pVM->pdm.s.pDmac)
    1334     {
    1335         bool fMore = pVM->pdm.s.pDmac->Reg.pfnRun(pVM->pdm.s.pDmac->pDevIns);
    1336         if (fMore)
    1337             VM_FF_SET(pVM, VM_FF_PDM_DMA);
     1332    /** @note Not really SMP safe; restrict it to VCPU 0? */
     1333    if (VMMGetCpuId(pVM) != 0)
     1334        return;
     1335
     1336    if (VM_FF_TESTANDCLEAR(pVM, VM_FF_PDM_DMA_BIT))
     1337    {
     1338        if (pVM->pdm.s.pDmac)
     1339        {
     1340            bool fMore = pVM->pdm.s.pDmac->Reg.pfnRun(pVM->pdm.s.pDmac->pDevIns);
     1341            if (fMore)
     1342                VM_FF_SET(pVM, VM_FF_PDM_DMA);
     1343        }
    13381344    }
    13391345}
  • trunk/src/VBox/VMM/PDMQueue.cpp

    r14074 r19420  
    617617    LogFlow(("PDMR3QueuesFlush:\n"));
    618618
    619     VM_FF_CLEAR(pVM, VM_FF_PDM_QUEUES);
    620     for (PPDMQUEUE pCur = pVM->pdm.s.pQueuesForced; pCur; pCur = pCur->pNext)
    621     {
    622         if (    pCur->pPendingR3
    623             ||  pCur->pPendingR0
    624             ||  pCur->pPendingRC)
    625         {
    626             if (    pdmR3QueueFlush(pCur)
    627                 &&  pCur->pPendingR3)
    628                 /* new items arrived while flushing. */
    629                 pdmR3QueueFlush(pCur);
     619    /* Use atomic test and clear to prevent useless checks; pdmR3QueueFlush is SMP safe. */
     620    if (VM_FF_TESTANDCLEAR(pVM, VM_FF_PDM_QUEUES_BIT))
     621    {
     622        for (PPDMQUEUE pCur = pVM->pdm.s.pQueuesForced; pCur; pCur = pCur->pNext)
     623        {
     624            if (    pCur->pPendingR3
     625                ||  pCur->pPendingR0
     626                ||  pCur->pPendingRC)
     627            {
     628                if (    pdmR3QueueFlush(pCur)
     629                    &&  pCur->pPendingR3)
     630                    /* new items arrived while flushing. */
     631                    pdmR3QueueFlush(pCur);
     632            }
    630633        }
    631634    }
  • trunk/src/VBox/VMM/VMReq.cpp

    r19402 r19420  
    837837     * We do not repeat the outer loop if we've got an informational status code
    838838     * since that code needs processing by our caller.
     839     */
     840    /**
     841     * @note SMP safe (multiple EMTs trying to satisfy VM_FF_REQUESTs)
    839842     */
    840843    int rc = VINF_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

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