VirtualBox

Changeset 13765 in vbox


Ignore:
Timestamp:
Nov 3, 2008 5:20:11 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
38741
Message:

VM request updates for dispatching packets to individual CPU threads.

Location:
trunk
Files:
5 edited

Legend:

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

    r13755 r13765  
    424424VMMR3DECL(int)  VMR3ReqQueue(PVMREQ pReq, unsigned cMillies);
    425425VMMR3DECL(int)  VMR3ReqWait(PVMREQ pReq, unsigned cMillies);
    426 VMMR3DECL(int)  VMR3ReqProcessU(PUVM pUVM);
     426VMMR3DECL(int)  VMR3ReqProcessU(PUVM pUVM, VMREQDEST enmDest);
    427427VMMR3DECL(void) VMR3NotifyFF(PVM pVM, bool fNotifiedREM);
    428428VMMR3DECL(void) VMR3NotifyFFU(PUVM pUVM, bool fNotifiedREM);
  • trunk/src/VBox/VMM/DBGF.cpp

    r13755 r13765  
    611611            {
    612612                LogFlow(("dbgfR3VMMWait: Processes requests...\n"));
    613                 rc = VMR3ReqProcessU(pVM->pUVM);
     613                rc = VMR3ReqProcessU(pVM->pUVM, VMREQDEST_ALL);
    614614                LogFlow(("dbgfR3VMMWait: VMR3ReqProcess -> %Vrc rcRet=%Vrc\n", rc, rcRet));
    615615                if (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST)
  • trunk/src/VBox/VMM/EM.cpp

    r13703 r13765  
    31163116        if (VM_FF_ISSET(pVM, VM_FF_REQUEST))
    31173117        {
    3118             rc2 = VMR3ReqProcessU(pVM->pUVM);
     3118            rc2 = VMR3ReqProcessU(pVM->pUVM, VMREQDEST_ALL);
    31193119            if (rc2 == VINF_EM_OFF || rc2 == VINF_EM_TERMINATE)
    31203120            {
  • trunk/src/VBox/VMM/VMEmt.cpp

    r13667 r13765  
    9797                 * Service execute in EMT request.
    9898                 */
    99                 rc = VMR3ReqProcessU(pUVM);
     99                rc = VMR3ReqProcessU(pUVM, VMREQDEST_ALL);
    100100                Log(("vmR3EmulationThread: Req rc=%Vrc, VM state %d -> %d\n", rc, enmBefore, pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING));
    101101            }
     
    132132                 * Service execute in EMT request.
    133133                 */
    134                 rc = VMR3ReqProcessU(pUVM);
     134                rc = VMR3ReqProcessU(pUVM, VMREQDEST_ALL);
    135135                Log(("vmR3EmulationThread: Req rc=%Vrc, VM state %d -> %d\n", rc, enmBefore, pVM->enmVMState));
    136136            }
     
    252252             * Service execute in EMT request.
    253253             */
    254             rc = VMR3ReqProcessU(pUVM);
     254            rc = VMR3ReqProcessU(pUVM, VMREQDEST_ALL);
    255255            Log(("vmR3EmulationThread: Req rc=%Vrc, VM state %d -> %d\n", rc, enmBefore, pVM->enmVMState));
    256256        }
  • trunk/src/VBox/VMM/VMReq.cpp

    r13755 r13765  
    401401                    VERR_VM_REQUEST_INVALID_TYPE);
    402402    AssertPtrReturn(ppReq, VERR_INVALID_POINTER);
     403    AssertMsgReturn(enmDest == VMREQDEST_ALL || (unsigned)enmDest < pUVM->pVM->cCPUs, ("Invalid destination %d (max=%d)\n", enmDest, pUVM->pVM->cCPUs), VERR_INVALID_PARAMETER);
    403404
    404405    /*
     
    619620    int rc = VINF_SUCCESS;
    620621    PUVM pUVM = ((VMREQ volatile *)pReq)->pUVM;                 /* volatile paranoia */
    621     if (pUVM->vm.s.NativeThreadEMT != RTThreadNativeSelf())
     622    if (    pReq->enmDest == VMREQDEST_ALL
     623        &&  pUVM->vm.s.NativeThreadEMT != RTThreadNativeSelf())
    622624    {
    623625        unsigned fFlags = ((VMREQ volatile *)pReq)->fFlags;     /* volatile paranoia */
     
    639641        if (pUVM->pVM)
    640642            VM_FF_SET(pUVM->pVM, VM_FF_REQUEST);
     643        VMR3NotifyFFU(pUVM, false);
     644
     645        /*
     646         * Wait and return.
     647         */
     648        if (!(fFlags & VMREQFLAGS_NO_WAIT))
     649            rc = VMR3ReqWait(pReq, cMillies);
     650        LogFlow(("VMR3ReqQueue: returns %Vrc\n", rc));
     651    }
     652    else
     653    if (    pReq->enmDest != VMREQDEST_ALL
     654        &&  pUVM->aCpu[pReq->enmDest].vm.s.NativeThreadEMT != RTThreadNativeSelf())
     655    {
     656        RTCPUID  idTarget = (RTCPUID)pReq->enmDest;
     657        unsigned fFlags = ((VMREQ volatile *)pReq)->fFlags;     /* volatile paranoia */
     658
     659        /*
     660         * Insert it.
     661         */
     662        pReq->enmState = VMREQSTATE_QUEUED;
     663        PVMREQ pNext;
     664        do
     665        {
     666            pNext = pUVM->aCpu[idTarget].vm.s.pReqs;
     667            pReq->pNext = pNext;
     668        } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pUVM->aCpu[idTarget].vm.s.pReqs, (void *)pReq, (void *)pNext));
     669
     670        /*
     671         * Notify EMT.
     672         */
     673        if (pUVM->pVM)
     674            VMCPU_FF_SET(pUVM->pVM, VM_FF_REQUEST, idTarget);
     675        /* @todo: VMR3NotifyFFU*/
     676        AssertFailed();
    641677        VMR3NotifyFFU(pUVM, false);
    642678
     
    735771 *
    736772 * @param   pUVM            Pointer to the user mode VM structure.
    737  */
    738 VMMR3DECL(int) VMR3ReqProcessU(PUVM pUVM)
    739 {
    740     LogFlow(("VMR3ReqProcessU: (enmVMState=%d)\n", pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING));
     773 * @param   enmDest         Destination of the request packet (global or per VCPU).
     774 */
     775VMMR3DECL(int) VMR3ReqProcessU(PUVM pUVM, VMREQDEST enmDest)
     776{
     777    LogFlow(("VMR3ReqProcessU: (enmVMState=%d) enmDest=%d\n", pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING, enmDest));
    741778
    742779    /*
     
    749786    while (rc <= VINF_SUCCESS)
    750787    {
     788        void *volatile *ppReqs;
     789
    751790        /*
    752791         * Get pending requests.
    753792         */
    754         if (RT_LIKELY(pUVM->pVM))
    755             VM_FF_CLEAR(pUVM->pVM, VM_FF_REQUEST);
    756         PVMREQ pReqs = (PVMREQ)ASMAtomicXchgPtr((void * volatile *)&pUVM->vm.s.pReqs, NULL);
     793        if (enmDest == VMREQDEST_ALL)
     794        {
     795            ppReqs = (void * volatile *)&pUVM->vm.s.pReqs;
     796            if (RT_LIKELY(pUVM->pVM))
     797                VM_FF_CLEAR(pUVM->pVM, VM_FF_REQUEST);
     798        }
     799        else
     800        {
     801            ppReqs = (void * volatile *)&pUVM->aCpu[enmDest].vm.s.pReqs;
     802            if (RT_LIKELY(pUVM->pVM))
     803                VMCPU_FF_CLEAR(pUVM->pVM, enmDest, VM_FF_REQUEST);
     804        }
     805
     806        PVMREQ pReqs = (PVMREQ)ASMAtomicXchgPtr(ppReqs, NULL);
    757807        if (!pReqs)
    758808            break;
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