VirtualBox

Changeset 6274 in vbox for trunk


Ignore:
Timestamp:
Jan 8, 2008 12:56:33 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27120
Message:

pReq may be invalid after queuing it (VMREQFLAGS_NO_WAIT), so make local copies of the fFlags and pVM members. This should fix the sporadic assertions we've been seeing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMReq.cpp

    r5999 r6274  
    526526    }
    527527
     528    /*
     529     * Are we the EMT or not?
     530     * Also, store pVM (and fFlags) locally since pReq may be invalid after queuing it.
     531     */
    528532    int rc = VINF_SUCCESS;
    529     if (pReq->pVM->NativeThreadEMT != RTThreadNativeSelf())
    530     {
     533    PVM pVM = ((VMREQ volatile *)pReq)->pVM;                    /* volatile paranoia */
     534    if (pVM->NativeThreadEMT != RTThreadNativeSelf())
     535    {
     536        unsigned fFlags = ((VMREQ volatile *)pReq)->fFlags;     /* volatile paranoia */
     537
    531538        /*
    532539         * Insert it.
     
    536543        do
    537544        {
    538             pNext = pReq->pVM->vm.s.pReqs;
     545            pNext = pVM->vm.s.pReqs;
    539546            pReq->pNext = pNext;
    540         } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pReq->pVM->vm.s.pReqs, (void *)pReq, (void *)pNext));
     547        } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pVM->vm.s.pReqs, (void *)pReq, (void *)pNext));
    541548
    542549        /*
    543550         * Notify EMT.
    544551         */
    545         VM_FF_SET(pReq->pVM, VM_FF_REQUEST);
    546         VMR3NotifyFF(pReq->pVM, false);
     552        VM_FF_SET(pVM, VM_FF_REQUEST);
     553        VMR3NotifyFF(pVM, false);
    547554
    548555        /*
    549556         * Wait and return.
    550557         */
    551         if (!(pReq->fFlags & VMREQFLAGS_NO_WAIT))
     558        if (!(fFlags & VMREQFLAGS_NO_WAIT))
    552559            rc = VMR3ReqWait(pReq, cMillies);
    553560        LogFlow(("VMR3ReqQueue: returns %Vrc\n", rc));
     
    559566         */
    560567        pReq->enmState = VMREQSTATE_QUEUED;
    561         rc = vmR3ReqProcessOne(pReq->pVM, pReq);
     568        rc = vmR3ReqProcessOne(pVM, pReq);
    562569        LogFlow(("VMR3ReqQueue: returns %Vrc (processed)\n", rc));
    563570    }
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