VirtualBox

Changeset 38838 in vbox


Ignore:
Timestamp:
Sep 23, 2011 11:21:55 AM (13 years ago)
Author:
vboxsync
Message:

VMM,++: Try fix the async reset, suspend and power-off problems in PDM wrt conflicting VMM requests. Split them into priority requests and normal requests. The priority requests can safely be processed when PDM is doing async state change waits, the normal ones cannot. (The problem I bumped into was a unmap-chunk request from PGM being processed during PDMR3Reset, causing a recursive VMMR3EmtRendezvous deadlock.)

Location:
trunk
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/dbgf.h

    r35694 r38838  
    510510VMMR3DECL(int) DBGFR3InfoDeregisterExternal(PVM pVM, const char *pszName);
    511511VMMR3DECL(int) DBGFR3Info(PVM pVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
     512VMMR3DECL(int) DBGFR3InfoEx(PVM pVM, VMCPUID idCpu, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
    512513VMMR3DECL(int) DBGFR3InfoLogRel(PVM pVM, const char *pszName, const char *pszArgs);
    513514VMMR3DECL(int) DBGFR3InfoStdErr(PVM pVM, const char *pszName, const char *pszArgs);
  • trunk/include/VBox/vmm/vmapi.h

    r37211 r38838  
    227227    VMREQFLAGS_NO_WAIT      = 2,
    228228    /** Poke the destination EMT(s) if executing guest code. Use with care. */
    229     VMREQFLAGS_POKE         = 4
     229    VMREQFLAGS_POKE         = 4,
     230    /** Priority request that can safely be processed while doing async
     231     *  suspend and power off. */
     232    VMREQFLAGS_PRIORITY     = 8
    230233} VMREQFLAGS;
    231234
     
    385388VMMR3DECL(int)      VMR3ReqCallVU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, va_list Args);
    386389VMMR3DECL(int)      VMR3ReqCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
    387 VMMR3DECL(int)      VMR3ReqCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
    388390VMMR3DECL(int)      VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
    389 VMMR3DECL(int)      VMR3ReqCallNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
    390391VMMR3DECL(int)      VMR3ReqCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
    391 VMMR3DECL(int)      VMR3ReqCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
    392392VMMR3DECL(int)      VMR3ReqCallVoidNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
    393 VMMR3DECL(int)      VMR3ReqCallVoidNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
     393VMMR3DECL(int)      VMR3ReqPriorityCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
     394VMMR3DECL(int)      VMR3ReqPriorityCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...);
    394395VMMR3DECL(int)      VMR3ReqAlloc(PVM pVM, PVMREQ *ppReq, VMREQTYPE enmType, VMCPUID idDstCpu);
    395396VMMR3DECL(int)      VMR3ReqAllocU(PUVM pUVM, PVMREQ *ppReq, VMREQTYPE enmType, VMCPUID idDstCpu);
     
    397398VMMR3DECL(int)      VMR3ReqQueue(PVMREQ pReq, RTMSINTERVAL cMillies);
    398399VMMR3DECL(int)      VMR3ReqWait(PVMREQ pReq, RTMSINTERVAL cMillies);
    399 VMMR3DECL(int)      VMR3ReqProcessU(PUVM pUVM, VMCPUID idDstCpu);
     400VMMR3DECL(int)      VMR3ReqProcessU(PUVM pUVM, VMCPUID idDstCpu, bool fPriorityOnly);
    400401VMMR3DECL(void)     VMR3NotifyGlobalFFU(PUVM pUVM, uint32_t fFlags);
    401402VMMR3DECL(void)     VMR3NotifyCpuFFU(PUVMCPU pUVMCpu, uint32_t fFlags);
  • trunk/src/VBox/Debugger/DBGCCommands.cpp

    r35696 r38838  
    906906     * Dump it.
    907907     */
    908     /** @todo DBGFR3Info should do this, not we. */
    909     int rc = VMR3ReqCallWait(pVM, pDbgc->idCpu, (PFNRT)DBGFR3Info, 4,
    910                              pVM, paArgs[0].u.pszString, cArgs == 2 ? paArgs[1].u.pszString : NULL,
    911                              DBGCCmdHlpGetDbgfOutputHlp(pCmdHlp));
     908    int rc = DBGFR3InfoEx(pVM, pDbgc->idCpu,
     909                          paArgs[0].u.pszString,
     910                          cArgs == 2 ? paArgs[1].u.pszString : NULL,
     911                          DBGCCmdHlpGetDbgfOutputHlp(pCmdHlp));
    912912    if (RT_FAILURE(rc))
    913         return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3Info()\n");
     913        return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3InfoEx()\n");
    914914
    915915    NOREF(pCmd);
  • trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp

    r35629 r38838  
    104104}
    105105VMMR3DECL(int) DBGFR3Info(PVM pVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
     106{
     107    return VERR_INTERNAL_ERROR;
     108}
     109VMMR3DECL(int) DBGFR3InfoEx(PVM pVM, VMCPUID idCpu, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
    106110{
    107111    return VERR_INTERNAL_ERROR;
     
    405409}
    406410
    407 VMMR3DECL(int) VMR3ReqCallWait(PVM pVm, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
    408 {
    409     return VERR_INTERNAL_ERROR;
    410 }
  • trunk/src/VBox/Devices/Storage/ATAController.cpp

    r37687 r38838  
    24082408
    24092409                        PDMCritSectLeave(&pCtl->lock);
    2410                         rc = VMR3ReqCallWait(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY,
    2411                                              (PFNRT)s->pDrvMount->pfnUnmount, 3, s->pDrvMount,
    2412                                              false /*=fForce*/, true /*=fEeject*/);
     2410                        rc = VMR3ReqPriorityCallWait(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY,
     2411                                                     (PFNRT)s->pDrvMount->pfnUnmount, 3, s->pDrvMount,
     2412                                                     false /*=fForce*/, true /*=fEeject*/);
    24132413                        Assert(RT_SUCCESS(rc) || (rc == VERR_PDM_MEDIA_LOCKED) || (rc = VERR_PDM_MEDIA_NOT_MOUNTED));
    24142414                        if (RT_SUCCESS(rc) && pCtl->pMediaNotify)
  • trunk/src/VBox/Devices/Storage/DevAHCI.cpp

    r38675 r38838  
    44154415                        PPDMDEVINS pDevIns = pAhci->CTX_SUFF(pDevIns);
    44164416
    4417                         rc2 = VMR3ReqCallWait(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY,
    4418                                               (PFNRT)pAhciPort->pDrvMount->pfnUnmount, 3,
    4419                                               pAhciPort->pDrvMount, false/*=fForce*/, true/*=fEject*/);
     4417                        rc2 = VMR3ReqPriorityCallWait(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY,
     4418                                                      (PFNRT)pAhciPort->pDrvMount->pfnUnmount, 3,
     4419                                                      pAhciPort->pDrvMount, false/*=fForce*/, true/*=fEject*/);
    44204420                        Assert(RT_SUCCESS(rc2) || (rc2 == VERR_PDM_MEDIA_LOCKED) || (rc2 = VERR_PDM_MEDIA_NOT_MOUNTED));
    44214421                        if (RT_SUCCESS(rc) && pAhci->pMediaNotify)
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r38710 r38838  
    31253125
    31263126                        PDMCritSectLeave(&pCtl->lock);
    3127                         rc = VMR3ReqCallWait(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY,
    3128                                              (PFNRT)s->pDrvMount->pfnUnmount, 3,
    3129                                              s->pDrvMount, false /*=fForce*/, true /*=fEject*/);
     3127                        rc = VMR3ReqPriorityCallWait(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY,
     3128                                                     (PFNRT)s->pDrvMount->pfnUnmount, 3,
     3129                                                     s->pDrvMount, false /*=fForce*/, true /*=fEject*/);
    31303130                        Assert(RT_SUCCESS(rc) || (rc == VERR_PDM_MEDIA_LOCKED) || (rc = VERR_PDM_MEDIA_NOT_MOUNTED));
    31313131                        if (RT_SUCCESS(rc) && pThis->pMediaNotify)
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r38642 r38838  
    22882288    while (cRetries-- > 0)
    22892289    {
    2290         vrc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)Display::displayTakeScreenshotEMT, 6,
    2291                               pDisplay, aScreenId, &pu8Data, &cbData, &cx, &cy);
     2290        /* Note! Not sure if the priority call is such a good idea here, but
     2291                 it would be nice to have an accurate screenshot for the bug
     2292                 report if the VM deadlocks. */
     2293        vrc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)Display::displayTakeScreenshotEMT, 6,
     2294                                      pDisplay, aScreenId, &pu8Data, &cbData, &cx, &cy);
    22922295        if (vrc != VERR_TRY_AGAIN)
    22932296        {
  • trunk/src/VBox/VMM/VMMAll/VMAll.cpp

    r35346 r38838  
    8181    va_list va2;
    8282    va_copy(va2, args); /* Have to make a copy here or GCC will break. */
    83     VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)vmR3SetErrorUV, 7,   /* ASSUMES 3 source pos args! */
    84                     pVM->pUVM, rc, RT_SRC_POS_ARGS, pszFormat, &va2);
     83    VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)vmR3SetErrorUV, 7,   /* ASSUMES 3 source pos args! */
     84                            pVM->pUVM, rc, RT_SRC_POS_ARGS, pszFormat, &va2);
    8585    va_end(va2);
    8686
     
    262262        va_list va2;
    263263        va_copy(va2, va); /* Have to make a copy here or GCC will break. */
    264         rc = VMR3ReqCallWaitU(pVM->pUVM, VMCPUID_ANY,
    265                               (PFNRT)vmR3SetRuntimeErrorV, 5, pVM, fFlags, pszErrorId, pszFormat, &va2);
     264        rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY,
     265                                     (PFNRT)vmR3SetRuntimeErrorV, 5, pVM, fFlags, pszErrorId, pszFormat, &va2);
    266266        va_end(va2);
    267267    }
     
    269269    {
    270270        char *pszMessage = MMR3HeapAPrintfV(pVM, MM_TAG_VM, pszFormat, va);
    271         rc = VMR3ReqCallNoWaitU(pVM->pUVM, VMCPUID_ANY,
    272                                 (PFNRT)vmR3SetRuntimeError, 4, pVM, fFlags, pszErrorId, pszMessage);
     271        rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY,
     272                               (PFNRT)vmR3SetRuntimeError, 4, pVM, fFlags, pszErrorId, pszMessage);
    273273        if (RT_FAILURE(rc))
    274274            MMR3HeapFree(pszMessage);
  • trunk/src/VBox/VMM/VMMR3/DBGF.cpp

    r37410 r38838  
    650650            {
    651651                LogFlow(("dbgfR3VMMWait: Processes requests...\n"));
    652                 rc = VMR3ReqProcessU(pVM->pUVM, VMCPUID_ANY);
     652                rc = VMR3ReqProcessU(pVM->pUVM, VMCPUID_ANY, false /*fPriorityOnly*/);
    653653                if (rc == VINF_SUCCESS)
    654                     rc = VMR3ReqProcessU(pVM->pUVM, pVCpu->idCpu);
     654                    rc = VMR3ReqProcessU(pVM->pUVM, pVCpu->idCpu, false /*fPriorityOnly*/);
    655655                LogFlow(("dbgfR3VMMWait: VMR3ReqProcess -> %Rrc rcRet=%Rrc\n", rc, rcRet));
    656656                cPollHack = 1;
     
    854854VMMR3DECL(int) DBGFR3Attach(PVM pVM)
    855855{
    856     /*
    857      * Some validations first.
    858      */
    859     if (!VALID_PTR(pVM))
    860     {
    861         Log(("DBGFR3Attach: bad VM handle: %p\n", pVM));
    862         return VERR_INVALID_HANDLE;
    863     }
    864     VMSTATE enmVMState = pVM->enmVMState;
    865     if (    enmVMState >= VMSTATE_DESTROYING
    866         ||  enmVMState <  VMSTATE_CREATING)
    867     {
    868         Log(("DBGFR3Attach: Invalid VM state: %s\n", VMGetStateName(enmVMState)));
    869         return VERR_INVALID_HANDLE;
    870     }
     856    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    871857
    872858    /*
  • trunk/src/VBox/VMM/VMMR3/DBGFAddr.cpp

    r35346 r38838  
    274274            rc = dbgfR3AddrToPhysOnVCpu(pVCpu, pAddress, pGCPhys);
    275275        else
    276             rc = VMR3ReqCallWait(pVCpu->pVMR3, pVCpu->idCpu,
    277                                  (PFNRT)dbgfR3AddrToPhysOnVCpu, 3, pVCpu, pAddress, pGCPhys);
     276            rc = VMR3ReqPriorityCallWait(pVCpu->pVMR3, pVCpu->idCpu,
     277                                         (PFNRT)dbgfR3AddrToPhysOnVCpu, 3, pVCpu, pAddress, pGCPhys);
    278278    }
    279279    return rc;
     
    432432     * Convert it.
    433433     */
    434     return VMR3ReqCallWait(pVM, idCpu, (PFNRT)dbgfR3AddrToVolatileR3PtrOnVCpu, 5, pVM, idCpu, pAddress, fReadOnly, ppvR3Ptr);
     434    return VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3AddrToVolatileR3PtrOnVCpu, 5, pVM, idCpu, pAddress, fReadOnly, ppvR3Ptr);
    435435}
    436436
  • trunk/src/VBox/VMM/VMMR3/DBGFBp.cpp

    r35694 r38838  
    281281{
    282282    /*
    283      * This must be done in EMT.
     283     * This must be done on EMT.
    284284     */
    285285    /** @todo SMP? */
    286     int rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpSetInt3, 5, pVM, pAddress, &iHitTrigger, &iHitDisable, piBp);
     286    int rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpSetInt3, 5, pVM, pAddress, &iHitTrigger, &iHitDisable, piBp);
    287287    LogFlow(("DBGFR3BpSet: returns %Rrc\n", rc));
    288288    return rc;
     
    439439    /** @todo SMP - broadcast, VT-x/AMD-V. */
    440440    /*
    441      * This must be done in EMT.
    442      */
    443     int rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpSetReg, 7, pVM, pAddress, &iHitTrigger, &iHitDisable, fType, cb, piBp);
     441     * This must be done on EMT.
     442     */
     443    int rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpSetReg, 7, pVM, pAddress, &iHitTrigger, &iHitDisable, fType, cb, piBp);
    444444    LogFlow(("DBGFR3BpSetReg: returns %Rrc\n", rc));
    445445    return rc;
     
    606606{
    607607    /*
    608      * This must be done in EMT.
    609      */
    610     int rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpSetREM, 5, pVM, pAddress, &iHitTrigger, &iHitDisable, piBp);
     608     * This must be done on EMT.
     609     */
     610    int rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpSetREM, 5, pVM, pAddress, &iHitTrigger, &iHitDisable, piBp);
    611611    LogFlow(("DBGFR3BpSetREM: returns %Rrc\n", rc));
    612612    return rc;
     
    698698{
    699699    /*
    700      * This must be done in EMT.
    701      */
    702     int rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpClear, 2, pVM, iBp);
     700     * This must be done on EMT.
     701     */
     702    int rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpClear, 2, pVM, iBp);
    703703    LogFlow(("DBGFR3BpClear: returns %Rrc\n", rc));
    704704    return rc;
     
    771771{
    772772    /*
    773      * This must be done in EMT.
    774      */
    775     int rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpEnable, 2, pVM, iBp);
     773     * This must be done on EMT.
     774     */
     775    int rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpEnable, 2, pVM, iBp);
    776776    LogFlow(("DBGFR3BpEnable: returns %Rrc\n", rc));
    777777    return rc;
     
    844844{
    845845    /*
    846      * This must be done in EMT.
    847      */
    848     int rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpDisable, 2, pVM, iBp);
     846     * This must be done on EMT.
     847     */
     848    int rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpDisable, 2, pVM, iBp);
    849849    LogFlow(("DBGFR3BpDisable: returns %Rrc\n", rc));
    850850    return rc;
     
    916916{
    917917    /*
    918      * This must be done in EMT.
    919      */
    920     int rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpEnum, 3, pVM, pfnCallback, pvUser);
     918     * This must be done on EMT.
     919     */
     920    int rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3BpEnum, 3, pVM, pfnCallback, pvUser);
    921921    LogFlow(("DBGFR3BpClear: returns %Rrc\n", rc));
    922922    return rc;
  • trunk/src/VBox/VMM/VMMR3/DBGFCpu.cpp

    r35346 r38838  
    6161
    6262    CPUMMODE enmMode;
    63     int rc = VMR3ReqCallWait(pVM, idCpu, (PFNRT)dbgfR3CpuGetMode, 3, pVM, idCpu, &enmMode);
     63    int rc = VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3CpuGetMode, 3, pVM, idCpu, &enmMode);
    6464    if (RT_FAILURE(rc))
    6565        return CPUMMODE_INVALID;
  • trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp

    r35346 r38838  
    593593        rc = dbgfR3DisasInstrExOnVCpu(pVM, pVCpu, Sel, &GCPtr, fFlags, pszOutput, cbOutput, pcbInstr);
    594594    else
    595         rc = VMR3ReqCallWait(pVM, idCpu, (PFNRT)dbgfR3DisasInstrExOnVCpu, 8,
    596                              pVM, VMMGetCpuById(pVM, idCpu), Sel, &GCPtr, fFlags, pszOutput, cbOutput, pcbInstr);
     595        rc = VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3DisasInstrExOnVCpu, 8,
     596                                     pVM, VMMGetCpuById(pVM, idCpu), Sel, &GCPtr, fFlags, pszOutput, cbOutput, pcbInstr);
    597597    return rc;
    598598}
  • trunk/src/VBox/VMM/VMMR3/DBGFInfo.cpp

    r35346 r38838  
    685685
    686686/**
    687  * Display a piece of info writing to the supplied handler.
    688  *
    689  * @returns VBox status code.
    690  * @param   pVM         VM handle.
    691  * @param   pszName     The identifier of the info to display.
    692  * @param   pszArgs     Arguments to the info handler.
    693  * @param   pHlp        The output helper functions. If NULL the logger will be used.
    694  */
    695 VMMR3DECL(int) DBGFR3Info(PVM pVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
     687 * Worker for DBGFR3Info and DBGFR3InfoEx.
     688 * 
     689 * @returns VBox status code.
     690 * @param   pVM                 The VM handle.
     691 * @param   idCpu               Which CPU to run EMT bound handlers on.
     692 *                              VMCPUID_ANY or a valid CPU ID.
     693 * @param   pszName             What to dump.
     694 * @param   pszArgs             Arguments, optional.
     695 * @param   pHlp                Output helper, optional.
     696 */
     697static DECLCALLBACK(int) dbgfR3Info(PVM pVM, VMCPUID idCpu, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
    696698{
    697699    /*
    698700     * Validate input.
    699701     */
    700     if (!pszName)
    701     {
    702         AssertMsgFailed(("!pszName\n"));
    703         return VERR_INVALID_PARAMETER;
    704     }
     702    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
    705703    if (pHlp)
    706704    {
     
    741739            case DBGFINFOTYPE_DEV:
    742740                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
    743                     rc = VMR3ReqCallVoidWait(pVM, VMCPUID_ANY, (PFNRT)Info.u.Dev.pfnHandler, 3, Info.u.Dev.pDevIns, pHlp, pszArgs);
     741                    rc = VMR3ReqCallVoidWait(pVM, idCpu, (PFNRT)Info.u.Dev.pfnHandler, 3, Info.u.Dev.pDevIns, pHlp, pszArgs);
    744742                else
    745743                    Info.u.Dev.pfnHandler(Info.u.Dev.pDevIns, pHlp, pszArgs);
     
    748746            case DBGFINFOTYPE_DRV:
    749747                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
    750                     rc = VMR3ReqCallVoidWait(pVM, VMCPUID_ANY, (PFNRT)Info.u.Drv.pfnHandler, 3, Info.u.Drv.pDrvIns, pHlp, pszArgs);
     748                    rc = VMR3ReqCallVoidWait(pVM, idCpu, (PFNRT)Info.u.Drv.pfnHandler, 3, Info.u.Drv.pDrvIns, pHlp, pszArgs);
    751749                else
    752750                    Info.u.Drv.pfnHandler(Info.u.Drv.pDrvIns, pHlp, pszArgs);
     
    755753            case DBGFINFOTYPE_INT:
    756754                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
    757                     rc = VMR3ReqCallVoidWait(pVM, VMCPUID_ANY, (PFNRT)Info.u.Int.pfnHandler, 3, pVM, pHlp, pszArgs);
     755                    rc = VMR3ReqCallVoidWait(pVM, idCpu, (PFNRT)Info.u.Int.pfnHandler, 3, pVM, pHlp, pszArgs);
    758756                else
    759757                    Info.u.Int.pfnHandler(pVM, pHlp, pszArgs);
     
    762760            case DBGFINFOTYPE_EXT:
    763761                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
    764                     rc = VMR3ReqCallVoidWait(pVM, VMCPUID_ANY, (PFNRT)Info.u.Ext.pfnHandler, 3, Info.u.Ext.pvUser, pHlp, pszArgs);
     762                    rc = VMR3ReqCallVoidWait(pVM, idCpu, (PFNRT)Info.u.Ext.pfnHandler, 3, Info.u.Ext.pvUser, pHlp, pszArgs);
    765763                else
    766764                    Info.u.Ext.pfnHandler(Info.u.Ext.pvUser, pHlp, pszArgs);
     
    780778    }
    781779    return rc;
     780}
     781
     782/**
     783 * Display a piece of info writing to the supplied handler.
     784 *
     785 * @returns VBox status code.
     786 * @param   pVM         VM handle.
     787 * @param   pszName     The identifier of the info to display.
     788 * @param   pszArgs     Arguments to the info handler.
     789 * @param   pHlp        The output helper functions. If NULL the logger will be used.
     790 */
     791VMMR3DECL(int) DBGFR3Info(PVM pVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
     792{
     793    return dbgfR3Info(pVM, VMCPUID_ANY, pszName, pszArgs, pHlp);
     794}
     795
     796
     797/**
     798 * Display a piece of info writing to the supplied handler.
     799 *
     800 * @returns VBox status code.
     801 * @param   pVM         VM handle.
     802 * @param   idCpu       The CPU to exectue the request on.  Pass NIL_VMCPUID
     803 *                      to not involve any EMT.
     804 * @param   pszName     The identifier of the info to display.
     805 * @param   pszArgs     Arguments to the info handler.
     806 * @param   pHlp        The output helper functions. If NULL the logger will be used.
     807 */
     808VMMR3DECL(int) DBGFR3InfoEx(PVM pVM, VMCPUID idCpu, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
     809{
     810    if (idCpu == NIL_VMCPUID)
     811        return dbgfR3Info(pVM, VMCPUID_ANY, pszName, pszArgs, pHlp);
     812    return VMR3ReqPriorityCallWait(pVM, idCpu,
     813                                   (PFNRT)dbgfR3Info, 5, pVM, idCpu, pszName, pszArgs, pHlp);
    782814}
    783815
  • trunk/src/VBox/VMM/VMMR3/DBGFLog.cpp

    r35346 r38838  
    4848    AssertPtrReturn(pszGroupSettings, VERR_INVALID_POINTER);
    4949
    50     return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyGroups, 2, pVM, pszGroupSettings);
     50    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyGroups, 2, pVM, pszGroupSettings);
    5151}
    5252
     
    8080    AssertPtrReturn(pszFlagSettings, VERR_INVALID_POINTER);
    8181
    82     return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyFlags, 2, pVM, pszFlagSettings);
     82    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyFlags, 2, pVM, pszFlagSettings);
    8383}
    8484
     
    112112    AssertReturn(VALID_PTR(pszDestSettings), VERR_INVALID_POINTER);
    113113
    114     return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyDestinations, 2, pVM, pszDestSettings);
     114    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyDestinations, 2, pVM, pszDestSettings);
    115115}
    116116
  • trunk/src/VBox/VMM/VMMR3/DBGFMem.cpp

    r35346 r38838  
    127127    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    128128    AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_CPU_ID);
    129     return VMR3ReqCallWait(pVM, idCpu, (PFNRT)dbgfR3MemScan, 8,
    130                            pVM, idCpu, pAddress, &cbRange, &uAlign, pvNeedle, cbNeedle, pHitAddress);
     129    return VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3MemScan, 8,
     130                                   pVM, idCpu, pAddress, &cbRange, &uAlign, pvNeedle, cbNeedle, pHitAddress);
    131131
    132132}
     
    212212        return VMMR3ReadR0Stack(pVM, idCpu, (RTHCUINTPTR)pAddress->FlatPtr, pvBuf, cbRead);
    213213    }
    214     return VMR3ReqCallWaitU(pVM->pUVM, idCpu, (PFNRT)dbgfR3MemRead, 5, pVM, idCpu, pAddress, pvBuf, cbRead);
     214    return VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3MemRead, 5, pVM, idCpu, pAddress, pvBuf, cbRead);
    215215}
    216216
     
    291291     * Pass it on to the EMT.
    292292     */
    293     return VMR3ReqCallWaitU(pVM->pUVM, idCpu, (PFNRT)dbgfR3MemReadString, 5, pVM, idCpu, pAddress, pszBuf, cchBuf);
     293    return VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3MemReadString, 5, pVM, idCpu, pAddress, pszBuf, cchBuf);
    294294}
    295295
     
    367367    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    368368    AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_CPU_ID);
    369     return VMR3ReqCallWaitU(pVM->pUVM, idCpu, (PFNRT)dbgfR3MemWrite, 5, pVM, idCpu, pAddress, pvBuf, cbWrite);
     369    return VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3MemWrite, 5, pVM, idCpu, pAddress, pvBuf, cbWrite);
    370370}
    371371
     
    470470     * Dispatch the request to a worker running on the target CPU.
    471471     */
    472     return VMR3ReqCallWaitU(pVM->pUVM, idCpu, (PFNRT)dbgfR3SelQueryInfo, 5, pVM, idCpu, Sel, fFlags, pSelInfo);
     472    return VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3SelQueryInfo, 5, pVM, idCpu, Sel, fFlags, pSelInfo);
    473473}
    474474
     
    657657     * Forward the request to the target CPU.
    658658     */
    659     return VMR3ReqCallWaitU(pVM->pUVM, idCpu, (PFNRT)dbgfR3PagingDumpEx, 8,
    660                             pVM, idCpu, fFlags, &cr3, &u64FirstAddr, &u64LastAddr, cMaxDepth, pHlp);
    661 }
    662 
     659    return VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3PagingDumpEx, 8,
     660                                   pVM, idCpu, fFlags, &cr3, &u64FirstAddr, &u64LastAddr, cMaxDepth, pHlp);
     661}
     662
  • trunk/src/VBox/VMM/VMMR3/DBGFOS.cpp

    r35346 r38838  
    156156     * Pass it on to EMT(0).
    157157     */
    158     return VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)dbgfR3OSRegister, 2, pVM, pReg);
     158    return VMR3ReqPriorityCallWait(pVM, 0 /*idDstCpu*/, (PFNRT)dbgfR3OSRegister, 2, pVM, pReg);
    159159}
    160160
     
    247247     * Pass it on to EMT(0).
    248248     */
    249     return VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)dbgfR3OSDeregister, 2, pVM, pReg);
     249    return VMR3ReqPriorityCallWait(pVM, 0 /*idDstCpu*/, (PFNRT)dbgfR3OSDeregister, 2, pVM, pReg);
    250250}
    251251
     
    319319     * Pass it on to EMT(0).
    320320     */
    321     return VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)dbgfR3OSDetect, 3, pVM, pszName, cchName);
     321    return VMR3ReqPriorityCallWait(pVM, 0 /*idDstCpu*/, (PFNRT)dbgfR3OSDetect, 3, pVM, pszName, cchName);
    322322}
    323323
     
    397397     * Pass it on to EMT(0).
    398398     */
    399     return VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/,
    400                             (PFNRT)dbgfR3OSQueryNameAndVersion, 5, pVM, pszName, cchName, pszVersion, cchVersion);
     399    return VMR3ReqPriorityCallWait(pVM, 0 /*idDstCpu*/,
     400                                   (PFNRT)dbgfR3OSQueryNameAndVersion, 5, pVM, pszName, cchName, pszVersion, cchVersion);
    401401}
    402402
     
    442442     */
    443443    void *pvIf = NULL;
    444     VMR3ReqCallVoidWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3OSQueryInterface, 3, pVM, enmIf, &pvIf);
     444    VMR3ReqPriorityCallVoidWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3OSQueryInterface, 3, pVM, enmIf, &pvIf);
    445445    return pvIf;
    446446}
  • trunk/src/VBox/VMM/VMMR3/DBGFReg.cpp

    r36826 r38838  
    864864    AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_CPU_ID);
    865865
    866     return VMR3ReqCallWait(pVM, idCpu, (PFNRT)dbgfR3RegCpuQueryWorkerOnCpu, 6,
    867                            pVM, idCpu, enmReg, enmType, fGuestRegs, pValue);
     866    return VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3RegCpuQueryWorkerOnCpu, 6,
     867                                   pVM, idCpu, enmReg, enmType, fGuestRegs, pValue);
    868868}
    869869
     
    14091409        else if (idDefCpu != VMCPUID_ANY)
    14101410            idDefCpu &= ~DBGFREG_HYPER_VMCPUID;
    1411         return VMR3ReqCallWait(pVM, idDefCpu, (PFNRT)dbgfR3RegNmQueryWorkerOnCpu, 5, pVM, pLookupRec, enmType, pValue, penmType);
     1411        return VMR3ReqPriorityCallWait(pVM, idDefCpu, (PFNRT)dbgfR3RegNmQueryWorkerOnCpu, 5, pVM, pLookupRec, enmType, pValue, penmType);
    14121412    }
    14131413    return VERR_DBGF_REGISTER_NOT_FOUND;
     
    22802280    Args.cchLeftBuf = cbBuf - 1;
    22812281    Args.rc         = VINF_SUCCESS;
    2282     int rc = VMR3ReqCallWait(pVM, Args.idCpu, (PFNRT)dbgfR3RegPrintfWorkerOnCpu, 1, &Args);
     2282    int rc = VMR3ReqPriorityCallWait(pVM, Args.idCpu, (PFNRT)dbgfR3RegPrintfWorkerOnCpu, 1, &Args);
    22832283    va_end(Args.va);
    22842284    return rc;
  • trunk/src/VBox/VMM/VMMR3/DBGFStack.cpp

    r35346 r38838  
    454454            AssertFailedReturn(VERR_INVALID_PARAMETER);
    455455    }
    456     return VMR3ReqCallWait(pVM, idCpu, (PFNRT)dbgfR3StackWalkCtxFull, 10,
    457                            pVM, idCpu, pCtxCore, hAs, enmCodeType,
    458                            pAddrFrame, pAddrStack, pAddrPC, enmReturnType, ppFirstFrame);
     456    return VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3StackWalkCtxFull, 10,
     457                                   pVM, idCpu, pCtxCore, hAs, enmCodeType,
     458                                   pAddrFrame, pAddrStack, pAddrPC, enmReturnType, ppFirstFrame);
    459459}
    460460
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r38612 r38838  
    14891489        if (VM_FF_IS_PENDING_EXCEPT(pVM, VM_FF_REQUEST, VM_FF_PGM_NO_MEMORY))
    14901490        {
    1491             rc2 = VMR3ReqProcessU(pVM->pUVM, VMCPUID_ANY);
     1491            rc2 = VMR3ReqProcessU(pVM->pUVM, VMCPUID_ANY, false /*fPriorityOnly*/);
    14921492            if (rc2 == VINF_EM_OFF || rc2 == VINF_EM_TERMINATE) /** @todo this shouldn't be necessary */
    14931493            {
     
    15411541        if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_REQUEST))
    15421542        {
    1543             rc2 = VMR3ReqProcessU(pVM->pUVM, pVCpu->idCpu);
     1543            rc2 = VMR3ReqProcessU(pVM->pUVM, pVCpu->idCpu, false /*fPriorityOnly*/);
    15441544            if (rc2 == VINF_EM_OFF || rc2 == VINF_EM_TERMINATE || rc2 == VINF_EM_RESET)
    15451545            {
  • trunk/src/VBox/VMM/VMMR3/FTM.cpp

    r38614 r38838  
    13291329            if (VM_FF_ISPENDING(pVM, VM_FF_REQUEST))
    13301330            {
    1331                 rc = VMR3ReqProcessU(pVM->pUVM, VMCPUID_ANY);
     1331                rc = VMR3ReqProcessU(pVM->pUVM, VMCPUID_ANY, true /*fPriorityOnly*/);
    13321332                AssertRC(rc);
    13331333            }
  • trunk/src/VBox/VMM/VMMR3/HWACCM.cpp

    r37323 r38838  
    17481748VMMR3DECL(int)  HWACMMR3EnablePatching(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem)
    17491749{
     1750    VM_ASSERT_EMT(pVM);
    17501751    Log(("HWACMMR3EnablePatching %RGv size %x\n", pPatchMem, cbPatchMem));
    17511752    if (pVM->cCpus > 1)
    17521753    {
    17531754        /* We own the IOM lock here and could cause a deadlock by waiting for a VCPU that is blocking on the IOM lock. */
    1754         int rc = VMR3ReqCallNoWaitU(pVM->pUVM, VMCPUID_ANY_QUEUE,
    1755                                     (PFNRT)hwaccmR3EnablePatching, 4, pVM, VMMGetCpuId(pVM), (RTRCPTR)pPatchMem, cbPatchMem);
     1755        int rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE,
     1756                                   (PFNRT)hwaccmR3EnablePatching, 4, pVM, VMMGetCpuId(pVM), (RTRCPTR)pPatchMem, cbPatchMem);
    17561757        AssertRC(rc);
    17571758        return rc;
  • trunk/src/VBox/VMM/VMMR3/PDM.cpp

    r38749 r38838  
    12361236static void pdmR3NotifyAsyncWaitAndProcessRequests(PPDMNOTIFYASYNCSTATS pThis, PVM pVM)
    12371237{
    1238     /** @todo This is utterly nuts and completely unsafe... will get back to it in a
    1239      *        bit I hope... */
    12401238    VM_ASSERT_EMT0(pVM);
    12411239    int rc = VMR3AsyncPdmNotificationWaitU(&pVM->pUVM->aCpus[0]);
    12421240    AssertReleaseMsg(rc == VINF_SUCCESS, ("%Rrc - %s - %s\n", rc, pThis->pszOp, pThis->szList));
    12431241
    1244     rc = VMR3ReqProcessU(pVM->pUVM, VMCPUID_ANY);
     1242    rc = VMR3ReqProcessU(pVM->pUVM, VMCPUID_ANY, true /*fPriorityOnly*/);
    12451243    AssertReleaseMsg(rc == VINF_SUCCESS, ("%Rrc - %s - %s\n", rc, pThis->pszOp, pThis->szList));
    1246     rc = VMR3ReqProcessU(pVM->pUVM, 0/*idDstCpu*/);
     1244    rc = VMR3ReqProcessU(pVM->pUVM, 0/*idDstCpu*/, true /*fPriorityOnly*/);
    12471245    AssertReleaseMsg(rc == VINF_SUCCESS, ("%Rrc - %s - %s\n", rc, pThis->pszOp, pThis->szList));
    12481246}
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r37466 r38838  
    31043104    {
    31053105        /* We own the IOM lock here and could cause a deadlock by waiting for a VCPU that is blocking on the IOM lock. */
    3106         rc = VMR3ReqCallNoWaitU(pVM->pUVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3Suspend, 1, pVM);
     3106        rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3Suspend, 1, pVM);
    31073107        AssertRC(rc);
    31083108        rc = VINF_EM_SUSPEND;
     
    31663166        && pVM->pUVM->pVmm2UserMethods->pfnSaveState)
    31673167    {
    3168         rc = VMR3ReqCallNoWaitU(pVM->pUVM, VMCPUID_ANY_QUEUE, (PFNRT)pdmR3DevHlp_VMSuspendSaveAndPowerOffWorker, 2, pVM, pDevIns);
     3168        rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)pdmR3DevHlp_VMSuspendSaveAndPowerOffWorker, 2, pVM, pDevIns);
    31693169        if (RT_SUCCESS(rc))
    31703170        {
     
    31953195    {
    31963196        /* We own the IOM lock here and could cause a deadlock by waiting for a VCPU that is blocking on the IOM lock. */
    3197         rc = VMR3ReqCallNoWaitU(pVM->pUVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3PowerOff, 1, pVM);
     3197        rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)VMR3PowerOff, 1, pVM);
    31983198        AssertRC(rc);
    31993199        /* Set the VCPU state to stopped here as well to make sure no
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r38708 r38838  
    142142                    pgmUnlock(pVM);
    143143
    144                     return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysReadExternalEMT, 4,
    145                                            pVM, &GCPhys, pvBuf, cbRead);
     144                    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysReadExternalEMT, 4,
     145                                                   pVM, &GCPhys, pvBuf, cbRead);
    146146                }
    147147                Assert(!PGM_PAGE_IS_MMIO(pPage));
     
    281281                        pgmUnlock(pVM);
    282282
    283                         return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysWriteExternalEMT, 4,
    284                                                pVM, &GCPhys, pvBuf, cbWrite);
     283                        return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysWriteExternalEMT, 4,
     284                                                       pVM, &GCPhys, pvBuf, cbWrite);
    285285                    }
    286286                }
     
    463463                    pgmUnlock(pVM);
    464464
    465                     return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysGCPhys2CCPtrDelegated, 4,
    466                                            pVM, &GCPhys, ppv, pLock);
     465                    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysGCPhys2CCPtrDelegated, 4,
     466                                                   pVM, &GCPhys, ppv, pLock);
    467467                }
    468468            }
     
    40004000        {
    40014001            /* Postpone the unmap operation (which requires a rendezvous operation) as we own the PGM lock here. */
    4002             rc = VMR3ReqCallNoWaitU(pVM->pUVM, VMCPUID_ANY_QUEUE, (PFNRT)pgmR3PhysUnmapChunk, 1, pVM);
     4002            rc = VMR3ReqCallNoWait(pVM, VMCPUID_ANY_QUEUE, (PFNRT)pgmR3PhysUnmapChunk, 1, pVM);
    40034003            AssertRC(rc);
    40044004        }
  • trunk/src/VBox/VMM/VMMR3/TM.cpp

    r37527 r38838  
    26962696VMMDECL(int) TMR3SetWarpDrive(PVM pVM, uint32_t u32Percent)
    26972697{
    2698     return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)tmR3SetWarpDrive, 2, pVM, u32Percent);
     2698    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)tmR3SetWarpDrive, 2, pVM, u32Percent);
    26992699}
    27002700
  • trunk/src/VBox/VMM/VMMR3/VM.cpp

    r38229 r38838  
    848848    for (VMCPUID idCpu = 1; idCpu < pVM->cCpus; idCpu++)
    849849    {
    850         rc = VMR3ReqCallWaitU(pUVM, idCpu, (PFNRT)vmR3RegisterEMT, 2, pVM, idCpu);
     850        rc = VMR3ReqCallWait(pVM, idCpu, (PFNRT)vmR3RegisterEMT, 2, pVM, idCpu);
    851851        if (RT_FAILURE(rc))
    852852            return rc;
     
    17331733     */
    17341734    PSSMHANDLE pSSM;
    1735     int rc = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/,
    1736                               (PFNRT)vmR3Save, 10, pVM, cMsMaxDowntime, pszFilename, pStreamOps, pvStreamOpsUser,
    1737                               enmAfter, pfnProgress, pvProgressUser, &pSSM, fSkipStateChanges);
     1735    int rc = VMR3ReqCallWait(pVM, 0 /*idDstCpu*/,
     1736                             (PFNRT)vmR3Save, 10, pVM, cMsMaxDowntime, pszFilename, pStreamOps, pvStreamOpsUser,
     1737                             enmAfter, pfnProgress, pvProgressUser, &pSSM, fSkipStateChanges);
    17381738    if (    RT_SUCCESS(rc)
    17391739        &&  pSSM)
     
    17631763                }
    17641764            if (RT_SUCCESS(rc))
    1765                 rc = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)vmR3LiveDoStep2, 2, pVM, pSSM);
     1765                rc = VMR3ReqCallWait(pVM, 0 /*idDstCpu*/, (PFNRT)vmR3LiveDoStep2, 2, pVM, pSSM);
    17661766            else
    17671767            {
    1768                 int rc2 = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)SSMR3LiveDone, 1, pSSM);
     1768                int rc2 = VMR3ReqCallWait(pVM, 0 /*idDstCpu*/, (PFNRT)SSMR3LiveDone, 1, pSSM);
    17691769                AssertMsg(rc2 == rc, ("%Rrc != %Rrc\n", rc2, rc));
    17701770            }
     
    17721772        else
    17731773        {
    1774             int rc2 = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)SSMR3LiveDone, 1, pSSM);
     1774            int rc2 = VMR3ReqCallWait(pVM, 0 /*idDstCpu*/, (PFNRT)SSMR3LiveDone, 1, pSSM);
    17751775            AssertMsg(rc2 == rc, ("%Rrc != %Rrc\n", rc2, rc));
    17761776
     
    20452045     * since there is no execution taking place when this call is allowed.
    20462046     */
    2047     int rc = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8,
    2048                               pVM, pszFilename, (uintptr_t)NULL /*pStreamOps*/, (uintptr_t)NULL /*pvStreamOpsUser*/, pfnProgress, pvUser,
    2049                               false /*fTeleporting*/, false /* fSkipStateChanges */);
     2047    int rc = VMR3ReqCallWait(pVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8,
     2048                             pVM, pszFilename, (uintptr_t)NULL /*pStreamOps*/, (uintptr_t)NULL /*pvStreamOpsUser*/, pfnProgress, pvUser,
     2049                             false /*fTeleporting*/, false /* fSkipStateChanges */);
    20502050    LogFlow(("VMR3LoadFromFile: returns %Rrc\n", rc));
    20512051    return rc;
     
    20842084     * since there is no execution taking place when this call is allowed.
    20852085     */
    2086     int rc = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8,
    2087                               pVM, (uintptr_t)NULL /*pszFilename*/, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser,
    2088                               true /*fTeleporting*/, false /* fSkipStateChanges */);
     2086    int rc = VMR3ReqCallWait(pVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8,
     2087                             pVM, (uintptr_t)NULL /*pszFilename*/, pStreamOps, pvStreamOpsUser, pfnProgress, pvProgressUser,
     2088                             true /*fTeleporting*/, false /* fSkipStateChanges */);
    20892089    LogFlow(("VMR3LoadFromStream: returns %Rrc\n", rc));
    20902090    return rc;
     
    21222122     * since there is no execution taking place when this call is allowed.
    21232123     */
    2124     int rc = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8,
    2125                               pVM, (uintptr_t)NULL /*pszFilename*/, pStreamOps, pvStreamOpsUser, NULL, NULL,
    2126                               true /*fTeleporting*/, true /* fSkipStateChanges */);
     2124    int rc = VMR3ReqCallWait(pVM, 0 /*idDstCpu*/, (PFNRT)vmR3Load, 8,
     2125                             pVM, (uintptr_t)NULL /*pszFilename*/, pStreamOps, pvStreamOpsUser, NULL, NULL,
     2126                             true /*fTeleporting*/, true /* fSkipStateChanges */);
    21272127    LogFlow(("VMR3LoadFromStream: returns %Rrc\n", rc));
    21282128    return rc;
     
    23492349     */
    23502350    /* vmR3Destroy on all EMTs, ending with EMT(0). */
    2351     rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ALL_REVERSE, (PFNRT)vmR3Destroy, 1, pVM);
     2351    rc = VMR3ReqCallWait(pVM, VMCPUID_ALL_REVERSE, (PFNRT)vmR3Destroy, 1, pVM);
    23522352    AssertLogRelRC(rc);
    23532353
     
    25352535    for (unsigned i = 0; i < 10; i++)
    25362536    {
    2537         PVMREQ pReqHead = ASMAtomicXchgPtrT(&pUVM->vm.s.pReqs, NULL, PVMREQ);
    2538         AssertMsg(!pReqHead, ("This isn't supposed to happen! VMR3Destroy caller has to serialize this.\n"));
     2537        PVMREQ pReqHead = ASMAtomicXchgPtrT(&pUVM->vm.s.pPriorityReqs, NULL, PVMREQ);
    25392538        if (!pReqHead)
    2540             break;
     2539        {
     2540            pReqHead = ASMAtomicXchgPtrT(&pUVM->vm.s.pNormalReqs, NULL, PVMREQ);
     2541            if (!pReqHead)
     2542                break;
     2543        }
     2544        AssertLogRelMsgFailed(("Requests pending! VMR3Destroy caller has to serialize this.\n"));
     2545
    25412546        for (PVMREQ pReq = pReqHead; pReq; pReq = pReq->pNext)
    25422547        {
     
    25602565        for (unsigned i = 0; i < 10; i++)
    25612566        {
    2562             PVMREQ pReqHead = ASMAtomicXchgPtrT(&pUVCpu->vm.s.pReqs, NULL, PVMREQ);
    2563             AssertMsg(!pReqHead, ("This isn't supposed to happen! VMR3Destroy caller has to serialize this.\n"));
     2567            PVMREQ pReqHead = ASMAtomicXchgPtrT(&pUVCpu->vm.s.pPriorityReqs, NULL, PVMREQ);
    25642568            if (!pReqHead)
    2565                 break;
     2569            {
     2570                pReqHead = ASMAtomicXchgPtrT(&pUVCpu->vm.s.pNormalReqs, NULL, PVMREQ);
     2571                if (!pReqHead)
     2572                    break;
     2573            }
     2574            AssertLogRelMsgFailed(("Requests pending! VMR3Destroy caller has to serialize this.\n"));
     2575
    25662576            for (PVMREQ pReq = pReqHead; pReq; pReq = pReq->pNext)
    25672577            {
     
    44314441     *        offline and send it to SPIP wait.  Maybe modify VMCPUSTATE and push
    44324442     *        it out of the EM loops when offline. */
    4433     return VMR3ReqCallNoWaitU(pVM->pUVM, idCpu, (PFNRT)vmR3HotUnplugCpu, 2, pVM, idCpu);
     4443    return VMR3ReqCallNoWait(pVM, idCpu, (PFNRT)vmR3HotUnplugCpu, 2, pVM, idCpu);
    44344444}
    44354445
  • trunk/src/VBox/VMM/VMMR3/VMEmt.cpp

    r36437 r38838  
    113113             * See also VMR3Create
    114114             */
    115             if (    pUVM->vm.s.pReqs
     115            if (    (pUVM->vm.s.pNormalReqs || pUVM->vm.s.pPriorityReqs)
    116116                &&  pUVCpu->idCpu == 0)
    117117            {
     
    119119                 * Service execute in any EMT request.
    120120                 */
    121                 rc = VMR3ReqProcessU(pUVM, VMCPUID_ANY);
     121                rc = VMR3ReqProcessU(pUVM, VMCPUID_ANY, false /*fPriorityOnly*/);
    122122                Log(("vmR3EmulationThread: Req rc=%Rrc, VM state %s -> %s\n", rc, VMR3GetStateName(enmBefore), pUVM->pVM ? VMR3GetStateName(pUVM->pVM->enmVMState) : "CREATING"));
    123123            }
    124             else if (pUVCpu->vm.s.pReqs)
     124            else if (pUVCpu->vm.s.pNormalReqs || pUVCpu->vm.s.pPriorityReqs)
    125125            {
    126126                /*
    127127                 * Service execute in specific EMT request.
    128128                 */
    129                 rc = VMR3ReqProcessU(pUVM, pUVCpu->idCpu);
     129                rc = VMR3ReqProcessU(pUVM, pUVCpu->idCpu, false /*fPriorityOnly*/);
    130130                Log(("vmR3EmulationThread: Req (cpu=%u) rc=%Rrc, VM state %s -> %s\n", pUVCpu->idCpu, rc, VMR3GetStateName(enmBefore), pUVM->pVM ? VMR3GetStateName(pUVM->pVM->enmVMState) : "CREATING"));
    131131            }
     
    164164                Log(("vmR3EmulationThread: Rendezvous rc=%Rrc, VM state %s -> %s\n", rc, VMR3GetStateName(enmBefore), VMR3GetStateName(pVM->enmVMState)));
    165165            }
    166             else if (pUVM->vm.s.pReqs)
     166            else if (pUVM->vm.s.pNormalReqs || pUVM->vm.s.pPriorityReqs)
    167167            {
    168168                /*
    169169                 * Service execute in any EMT request.
    170170                 */
    171                 rc = VMR3ReqProcessU(pUVM, VMCPUID_ANY);
     171                rc = VMR3ReqProcessU(pUVM, VMCPUID_ANY, false /*fPriorityOnly*/);
    172172                Log(("vmR3EmulationThread: Req rc=%Rrc, VM state %s -> %s\n", rc, VMR3GetStateName(enmBefore), VMR3GetStateName(pVM->enmVMState)));
    173173            }
    174             else if (pUVCpu->vm.s.pReqs)
     174            else if (pUVCpu->vm.s.pNormalReqs || pUVCpu->vm.s.pPriorityReqs)
    175175            {
    176176                /*
    177177                 * Service execute in specific EMT request.
    178178                 */
    179                 rc = VMR3ReqProcessU(pUVM, pUVCpu->idCpu);
     179                rc = VMR3ReqProcessU(pUVM, pUVCpu->idCpu, false /*fPriorityOnly*/);
    180180                Log(("vmR3EmulationThread: Req (cpu=%u) rc=%Rrc, VM state %s -> %s\n", pUVCpu->idCpu, rc, VMR3GetStateName(enmBefore), VMR3GetStateName(pVM->enmVMState)));
    181181            }
     
    847847         * Check Relevant FFs.
    848848         */
    849         if (pUVM->vm.s.pReqs)   /* global requests pending? */
    850             break;
    851         if (pUVCpu->vm.s.pReqs) /* local requests pending? */
     849        if (pUVM->vm.s.pNormalReqs   || pUVM->vm.s.pPriorityReqs)   /* global requests pending? */
     850            break;
     851        if (pUVCpu->vm.s.pNormalReqs || pUVCpu->vm.s.pPriorityReqs) /* local requests pending? */
    852852            break;
    853853
  • trunk/src/VBox/VMM/VMMR3/VMReq.cpp

    r38613 r38838  
    122122 * Convenience wrapper for VMR3ReqCallU.
    123123 *
    124  * This assumes (1) you're calling a function that returns an VBox status code,
    125  * (2) that you want it's return code on success, and (3) that you wish to wait
    126  * for ever for it to return.
    127  *
    128  * @returns VBox status code.  In the unlikely event that VMR3ReqCallVU fails,
    129  *          its status code is return.  Otherwise, the status of pfnFunction is
    130  *          returned.
    131  *
    132  * @param   pUVM            Pointer to the user mode VM structure.
    133  * @param   idDstCpu        The destination CPU(s). Either a specific CPU ID or
    134  *                          one of the following special values:
    135  *                              VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
    136  * @param   pfnFunction     Pointer to the function to call.
    137  * @param   cArgs           Number of arguments following in the ellipsis.
    138  * @param   ...             Function arguments.
    139  *
    140  * @remarks See remarks on VMR3ReqCallVU.
    141  */
    142 VMMR3DECL(int) VMR3ReqCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
    143 {
    144     PVMREQ pReq;
    145     va_list va;
    146     va_start(va, cArgs);
    147     int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    148                            pfnFunction, cArgs, va);
    149     va_end(va);
    150     if (RT_SUCCESS(rc))
    151         rc = pReq->iStatus;
    152     VMR3ReqFree(pReq);
    153     return rc;
    154 }
    155 
    156 
    157 /**
    158  * Convenience wrapper for VMR3ReqCallU.
    159  *
    160124 * This assumes (1) you're calling a function that returns an VBox status code
    161125 * and that you do not wish to wait for it to complete.
     
    178142    va_start(va, cArgs);
    179143    int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT,
    180                            pfnFunction, cArgs, va);
    181     va_end(va);
    182     return rc;
    183 }
    184 
    185 
    186 /**
    187  * Convenience wrapper for VMR3ReqCallU.
    188  *
    189  * This assumes (1) you're calling a function that returns an VBox status code
    190  * and that you do not wish to wait for it to complete.
    191  *
    192  * @returns VBox status code returned by VMR3ReqCallVU.
    193  *
    194  * @param   pUVM            Pointer to the user mode VM structure.
    195  * @param   idDstCpu        The destination CPU(s). Either a specific CPU ID or
    196  *                          one of the following special values:
    197  *                              VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
    198  * @param   pfnFunction     Pointer to the function to call.
    199  * @param   cArgs           Number of arguments following in the ellipsis.
    200  * @param   ...             Function arguments.
    201  *
    202  * @remarks See remarks on VMR3ReqCallVU.
    203  */
    204 VMMR3DECL(int) VMR3ReqCallNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
    205 {
    206     va_list va;
    207     va_start(va, cArgs);
    208     int rc = VMR3ReqCallVU(pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT,
    209144                           pfnFunction, cArgs, va);
    210145    va_end(va);
     
    248183 *
    249184 * This assumes (1) you're calling a function that returns void, and (2) that
    250  * you wish to wait for ever for it to return.
    251  *
    252  * @returns VBox status code of VMR3ReqCallVU.
    253  *
    254  * @param   pUVM            Pointer to the user mode VM structure.
    255  * @param   idDstCpu        The destination CPU(s). Either a specific CPU ID or
    256  *                          one of the following special values:
    257  *                              VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
    258  * @param   pfnFunction     Pointer to the function to call.
    259  * @param   cArgs           Number of arguments following in the ellipsis.
    260  * @param   ...             Function arguments.
    261  *
    262  * @remarks See remarks on VMR3ReqCallVU.
    263  */
    264 VMMR3DECL(int) VMR3ReqCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
    265 {
    266     PVMREQ pReq;
    267     va_list va;
    268     va_start(va, cArgs);
    269     int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID,
    270                            pfnFunction, cArgs, va);
    271     va_end(va);
    272     VMR3ReqFree(pReq);
    273     return rc;
    274 }
    275 
    276 
    277 /**
    278  * Convenience wrapper for VMR3ReqCallU.
    279  *
    280  * This assumes (1) you're calling a function that returns void, and (2) that
    281185 * you do not wish to wait for it to complete.
    282186 *
     
    309213 * Convenience wrapper for VMR3ReqCallU.
    310214 *
    311  * This assumes (1) you're calling a function that returns void, and (2) that
    312  * you do not wish to wait for it to complete.
    313  *
    314  * @returns VBox status code of VMR3ReqCallVU.
    315  *
    316  * @param   pUVM            Pointer to the user mode VM structure.
     215 * This assumes (1) you're calling a function that returns an VBox status code,
     216 * (2) that you want it's return code on success, (3) that you wish to wait for
     217 * ever for it to return, and (4) that it's priority request that can be safely
     218 * be handled during async suspend and power off.
     219 *
     220 * @returns VBox status code.  In the unlikely event that VMR3ReqCallVU fails,
     221 *          its status code is return.  Otherwise, the status of pfnFunction is
     222 *          returned.
     223 *
     224 * @param   pVM             Pointer to the shared VM structure.
    317225 * @param   idDstCpu        The destination CPU(s). Either a specific CPU ID or
    318226 *                          one of the following special values:
     
    324232 * @remarks See remarks on VMR3ReqCallVU.
    325233 */
    326 VMMR3DECL(int) VMR3ReqCallVoidNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
     234VMMR3DECL(int) VMR3ReqPriorityCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
    327235{
    328236    PVMREQ pReq;
    329237    va_list va;
    330238    va_start(va, cArgs);
    331     int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_NO_WAIT,
     239    int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_PRIORITY,
     240                           pfnFunction, cArgs, va);
     241    va_end(va);
     242    if (RT_SUCCESS(rc))
     243        rc = pReq->iStatus;
     244    VMR3ReqFree(pReq);
     245    return rc;
     246}
     247
     248
     249/**
     250 * Convenience wrapper for VMR3ReqCallU.
     251 *
     252 * This assumes (1) you're calling a function that returns void, (2) that you
     253 * wish to wait for ever for it to return, and (3) that it's priority request
     254 * that can be safely be handled during async suspend and power off.
     255 *
     256 * @returns VBox status code of VMR3ReqCallVU.
     257 *
     258 * @param   pVM             Pointer to the shared VM structure.
     259 * @param   idDstCpu        The destination CPU(s). Either a specific CPU ID or
     260 *                          one of the following special values:
     261 *                              VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
     262 * @param   pfnFunction     Pointer to the function to call.
     263 * @param   cArgs           Number of arguments following in the ellipsis.
     264 * @param   ...             Function arguments.
     265 *
     266 * @remarks See remarks on VMR3ReqCallVU.
     267 */
     268VMMR3DECL(int) VMR3ReqPriorityCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
     269{
     270    PVMREQ pReq;
     271    va_list va;
     272    va_start(va, cArgs);
     273    int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_PRIORITY,
    332274                           pfnFunction, cArgs, va);
    333275    va_end(va);
     
    424366    AssertPtrReturn(pfnFunction, VERR_INVALID_POINTER);
    425367    AssertPtrReturn(pUVM, VERR_INVALID_POINTER);
    426     AssertReturn(!(fFlags & ~(VMREQFLAGS_RETURN_MASK | VMREQFLAGS_NO_WAIT | VMREQFLAGS_POKE)), VERR_INVALID_PARAMETER);
     368    AssertReturn(!(fFlags & ~(VMREQFLAGS_RETURN_MASK | VMREQFLAGS_NO_WAIT | VMREQFLAGS_POKE | VMREQFLAGS_PRIORITY)), VERR_INVALID_PARAMETER);
    427369    if (!(fFlags & VMREQFLAGS_NO_WAIT) || ppReq)
    428370    {
     
    800742                     pReq->enmType, VMREQTYPE_INVALID + 1, VMREQTYPE_MAX - 1),
    801743                    VERR_VM_REQUEST_INVALID_TYPE);
    802     Assert(!(pReq->fFlags & ~(VMREQFLAGS_RETURN_MASK | VMREQFLAGS_NO_WAIT | VMREQFLAGS_POKE)));
     744    Assert(!(pReq->fFlags & ~(VMREQFLAGS_RETURN_MASK | VMREQFLAGS_NO_WAIT | VMREQFLAGS_POKE | VMREQFLAGS_PRIORITY)));
    803745
    804746    /*
     
    853795         * Insert it.
    854796         */
     797        volatile PVMREQ *ppQueueHead = pReq->fFlags & VMREQFLAGS_PRIORITY ? &pUVCpu->vm.s.pPriorityReqs : &pUVCpu->vm.s.pNormalReqs;
    855798        pReq->enmState = VMREQSTATE_QUEUED;
    856799        PVMREQ pNext;
    857800        do
    858801        {
    859             pNext = ASMAtomicUoReadPtrT(&pUVCpu->vm.s.pReqs, PVMREQ);
     802            pNext = ASMAtomicUoReadPtrT(ppQueueHead, PVMREQ);
    860803            ASMAtomicWritePtr(&pReq->pNext, pNext);
    861804            ASMCompilerBarrier();
    862         } while (!ASMAtomicCmpXchgPtr(&pUVCpu->vm.s.pReqs, pReq, pNext));
     805        } while (!ASMAtomicCmpXchgPtr(ppQueueHead, pReq, pNext));
    863806
    864807        /*
     
    887830         * Insert it.
    888831         */
     832        volatile PVMREQ *ppQueueHead = pReq->fFlags & VMREQFLAGS_PRIORITY ? &pUVM->vm.s.pPriorityReqs : &pUVM->vm.s.pNormalReqs;
    889833        pReq->enmState = VMREQSTATE_QUEUED;
    890834        PVMREQ pNext;
    891835        do
    892836        {
    893             pNext = ASMAtomicUoReadPtrT(&pUVM->vm.s.pReqs, PVMREQ);
     837            pNext = ASMAtomicUoReadPtrT(ppQueueHead, PVMREQ);
    894838            ASMAtomicWritePtr(&pReq->pNext, pNext);
    895839            ASMCompilerBarrier();
    896         } while (!ASMAtomicCmpXchgPtr(&pUVM->vm.s.pReqs, pReq, pNext));
     840        } while (!ASMAtomicCmpXchgPtr(ppQueueHead, pReq, pNext));
    897841
    898842        /*
     
    989933
    990934/**
     935 * Sets the relevant FF.
     936 * 
     937 * @param   pUVM            Pointer to the user mode VM structure.
     938 * @param   idDstCpu        VMCPUID_ANY or the ID of the current CPU.
     939 */
     940DECLINLINE(void) vmR3ReqSetFF(PUVM pUVM, VMCPUID idDstCpu)
     941{
     942    if (RT_LIKELY(pUVM->pVM))
     943    {
     944        if (idDstCpu == VMCPUID_ANY)
     945            VM_FF_SET(pUVM->pVM, VM_FF_REQUEST);
     946        else
     947            VMCPU_FF_SET(&pUVM->pVM->aCpus[idDstCpu], VMCPU_FF_REQUEST);
     948    }
     949}
     950
     951
     952/**
    991953 * VMR3ReqProcessU helper that handles cases where there are more than one
    992954 * pending request.
     
    1001963{
    1002964    STAM_COUNTER_INC(&pUVM->vm.s.StatReqMoreThan1);
    1003     /* Chop off the last one (pReq). */
     965
     966    /*
     967     * Chop off the last one (pReq).
     968     */
    1004969    PVMREQ pPrev;
    1005970    PVMREQ pReqRet = pReqList;
     
    1011976    ASMAtomicWriteNullPtr(&pPrev->pNext);
    1012977
    1013     /* Push the others back onto the list (end of it). */
     978    /*
     979     * Push the others back onto the list (end of it).
     980     */
    1014981    Log2(("VMR3ReqProcess: Pushing back %p %p...\n", pReqList, pReqList->pNext));
    1015982    if (RT_UNLIKELY(!ASMAtomicCmpXchgPtr(ppReqs, pReqList, NULL)))
     
    1031998    }
    1032999
    1033     if (RT_LIKELY(pUVM->pVM))
    1034     {
    1035         if (idDstCpu == VMCPUID_ANY)
    1036             VM_FF_SET(pUVM->pVM, VM_FF_REQUEST);
    1037         else
    1038             VMCPU_FF_SET(&pUVM->pVM->aCpus[idDstCpu], VMCPU_FF_REQUEST);
    1039     }
    1040 
     1000    vmR3ReqSetFF(pUVM, idDstCpu);
    10411001    return pReqRet;
    10421002}
     
    10551015 *                          and the CPU ID for a CPU specific one. In the latter
    10561016 *                          case the calling thread must be the EMT of that CPU.
     1017 * @param   fPriorityOnly   When set, only process the priority request queue.
    10571018 *
    10581019 * @note    SMP safe (multiple EMTs trying to satisfy VM_FF_REQUESTs).
    10591020 *
    1060  * @remarks This was made reentrant for
    1061  */
    1062 VMMR3DECL(int) VMR3ReqProcessU(PUVM pUVM, VMCPUID idDstCpu)
     1021 * @remarks This was made reentrant for async PDM handling, the debugger and
     1022 *          others.
     1023 */
     1024VMMR3DECL(int) VMR3ReqProcessU(PUVM pUVM, VMCPUID idDstCpu, bool fPriorityOnly)
    10631025{
    10641026    LogFlow(("VMR3ReqProcessU: (enmVMState=%d) idDstCpu=%d\n", pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING, idDstCpu));
     1027
     1028    /*
     1029     * Determine which queues to process.
     1030     */
     1031    PVMREQ volatile *ppNormalReqs;
     1032    PVMREQ volatile *ppPriorityReqs;
     1033    if (idDstCpu == VMCPUID_ANY)
     1034    {
     1035        ppPriorityReqs = &pUVM->vm.s.pPriorityReqs;
     1036        ppNormalReqs   = !fPriorityOnly ? &pUVM->vm.s.pNormalReqs                 : ppPriorityReqs;
     1037    }
     1038    else
     1039    {
     1040        Assert(idDstCpu < pUVM->cCpus);
     1041        Assert(pUVM->aCpus[idDstCpu].vm.s.NativeThreadEMT == RTThreadNativeSelf());
     1042        ppPriorityReqs = &pUVM->aCpus[idDstCpu].vm.s.pPriorityReqs;
     1043        ppNormalReqs   = !fPriorityOnly ? &pUVM->aCpus[idDstCpu].vm.s.pNormalReqs : ppPriorityReqs;
     1044    }
    10651045
    10661046    /*
     
    10741054    {
    10751055        /*
    1076          * Get the pending requests.
     1056         * Get the pending requests.
     1057         * 
    10771058         * If there are more than one request, unlink the oldest and put the
    10781059         * rest back so that we're reentrant.
    10791060         */
    1080         PVMREQ volatile *ppReqs;
    1081         if (idDstCpu == VMCPUID_ANY)
    1082         {
    1083             ppReqs = &pUVM->vm.s.pReqs;
    1084             if (RT_LIKELY(pUVM->pVM))
     1061        if (RT_LIKELY(pUVM->pVM))
     1062        {
     1063            if (idDstCpu == VMCPUID_ANY)
    10851064                VM_FF_CLEAR(pUVM->pVM, VM_FF_REQUEST);
     1065            else
     1066                VMCPU_FF_CLEAR(&pUVM->pVM->aCpus[idDstCpu], VMCPU_FF_REQUEST);
     1067        }
     1068
     1069        PVMREQ pReq = ASMAtomicXchgPtrT(ppPriorityReqs, NULL, PVMREQ);
     1070        if (pReq)
     1071        {
     1072            if (RT_UNLIKELY(pReq->pNext))
     1073                pReq = vmR3ReqProcessUTooManyHelper(pUVM, idDstCpu, pReq, ppPriorityReqs);
     1074            else if (ASMAtomicReadPtrT(ppNormalReqs, PVMREQ))
     1075                vmR3ReqSetFF(pUVM, idDstCpu);
    10861076        }
    10871077        else
    10881078        {
    1089             Assert(idDstCpu < pUVM->cCpus);
    1090             Assert(pUVM->aCpus[idDstCpu].vm.s.NativeThreadEMT == RTThreadNativeSelf());
    1091             ppReqs = &pUVM->aCpus[idDstCpu].vm.s.pReqs;
    1092             if (RT_LIKELY(pUVM->pVM))
    1093                 VMCPU_FF_CLEAR(&pUVM->pVM->aCpus[idDstCpu], VMCPU_FF_REQUEST);
     1079            pReq = ASMAtomicXchgPtrT(ppNormalReqs, NULL, PVMREQ);
     1080            if (!pReq)
     1081                break;
     1082            if (RT_UNLIKELY(pReq->pNext))
     1083                pReq = vmR3ReqProcessUTooManyHelper(pUVM, idDstCpu, pReq, ppNormalReqs);
    10941084        }
    1095 
    1096         PVMREQ pReq = ASMAtomicXchgPtrT(ppReqs, NULL, PVMREQ);
    1097         if (!pReq)
    1098             break;
    1099         if (RT_UNLIKELY(pReq->pNext))
    1100             pReq = vmR3ReqProcessUTooManyHelper(pUVM, idDstCpu, pReq, ppReqs);
    11011085
    11021086        /*
     
    11291113{
    11301114    LogFlow(("vmR3ReqProcessOneU: pReq=%p type=%d fFlags=%#x\n", pReq, pReq->enmType, pReq->fFlags));
     1115
     1116#if 1 /*def VBOX_STRICT */
     1117    /*
     1118     * Disable rendezvous if servicing a priority request.  Priority requests
     1119     * can not make use of the EMT rendezvous API.
     1120     */
     1121    PVMCPU      pVCpu               = NULL;
     1122    bool        fSavedInRendezvous  = true;
     1123    bool const  fPriorityReq        = RT_BOOL(pReq->fFlags & VMREQFLAGS_PRIORITY);
     1124    if (fPriorityReq && pUVM->pVM)
     1125    {
     1126        pVCpu = VMMGetCpu(pUVM->pVM);
     1127        fSavedInRendezvous = VMMR3EmtRendezvousSetDisabled(pVCpu, true /*fDisabled*/);
     1128    }
     1129#endif
    11311130
    11321131    /*
     
    12651264        }
    12661265    }
     1266
     1267#if 1 /*def VBOX_STRICT */
     1268    /*
     1269     * Restore the rendezvous disabled state.
     1270     */
     1271    if (!fSavedInRendezvous)
     1272        VMMR3EmtRendezvousSetDisabled(pVCpu, false /*fDisabled*/);
     1273#endif
    12671274    return rcRet;
    12681275}
  • trunk/src/VBox/VMM/include/VMInternal.h

    r36041 r38838  
    174174typedef struct VMINTUSERPERVM
    175175{
    176     /** Head of the request queue. Atomic. */
    177     volatile PVMREQ                 pReqs;
     176    /** Head of the standard request queue. Atomic. */
     177    volatile PVMREQ                 pNormalReqs;
     178    /** Head of the priority request queue. Atomic. */
     179    volatile PVMREQ                 pPriorityReqs;
    178180    /** The last index used during alloc/free. */
    179181    volatile uint32_t               iReqFree;
     
    315317typedef struct VMINTUSERPERVMCPU
    316318{
    317     /** Head of the request queue. Atomic. */
    318     volatile PVMREQ                 pReqs;
     319    /** Head of the normal request queue. Atomic. */
     320    volatile PVMREQ                 pNormalReqs;
     321    /** Head of the priority request queue. Atomic. */
     322    volatile PVMREQ                 pPriorityReqs;
    319323
    320324    /** The handle to the EMT thread. */
  • trunk/src/VBox/VMM/testcase/tstVMM.cpp

    r38636 r38838  
    274274                for (VMCPUID idCpu = 1; idCpu < g_cCpus; idCpu++)
    275275                {
    276                     rc = VMR3ReqCallNoWaitU(pVM->pUVM, idCpu, (PFNRT)tstTMWorker, 2, pVM, hTest);
     276                    rc = VMR3ReqCallNoWait(pVM, idCpu, (PFNRT)tstTMWorker, 2, pVM, hTest);
    277277                    if (RT_FAILURE(rc))
    278278                        RTTestFailed(hTest, "VMR3ReqCall failed: rc=%Rrc\n", rc);
  • trunk/src/recompiler/VBoxREMWrapper.cpp

    r38364 r38838  
    12911291    { "TRPMSetFaultAddress",                    VMM_FN(TRPMSetFaultAddress),            &g_aArgsTRPMSetFaultAddress[0],             RT_ELEMENTS(g_aArgsTRPMSetFaultAddress),               REMFNDESC_FLAGS_RET_VOID,   0,                  NULL },
    12921292    { "VMMGetCpu",                              VMM_FN(VMMGetCpu),                      &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_INT,    sizeof(PVMCPU),     NULL },
    1293     { "VMR3ReqCallWait",                        VMM_FN(VMR3ReqCallWait),                &g_aArgsVMR3ReqCallWait[0],                 RT_ELEMENTS(g_aArgsVMR3ReqCallWait),                   REMFNDESC_FLAGS_RET_INT,    sizeof(int),        NULL },
    1294     { "VMR3ReqFree",                            VMM_FN(VMR3ReqFree),                    &g_aArgsVMR3ReqFree[0],                     RT_ELEMENTS(g_aArgsVMR3ReqFree),                       REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_ELLIPSIS, sizeof(int), NULL },
     1293    { "VMR3ReqCallWait",                        VMM_FN(VMR3ReqCallWait),                &g_aArgsVMR3ReqCallWait[0],                 RT_ELEMENTS(g_aArgsVMR3ReqCallWait),                   REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_ELLIPSIS, sizeof(int), NULL },
     1294    { "VMR3ReqPriorityCallWait",                VMM_FN(VMR3ReqPriorityCallWait),        &g_aArgsVMR3ReqCallWait[0],                 RT_ELEMENTS(g_aArgsVMR3ReqCallWait),                   REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_ELLIPSIS, sizeof(int), NULL },
     1295    { "VMR3ReqFree",                            VMM_FN(VMR3ReqFree),                    &g_aArgsVMR3ReqFree[0],                     RT_ELEMENTS(g_aArgsVMR3ReqFree),                       REMFNDESC_FLAGS_RET_INT,    sizeof(int),        NULL },
    12951296    { "VMR3GetVMCPUId",                         VMM_FN(VMR3GetVMCPUId),                 &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_INT,    sizeof(int),        NULL },
    12961297    { "VMR3GetVMCPUNativeThread",               VMM_FN(VMR3GetVMCPUNativeThread),       &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_INT,    sizeof(void *),     NULL },
    1297     { "EMInterpretInstructionCPU",              VMM_FN(EMInterpretInstructionCPU),      &g_aArgsEMInterpretInstructionCPU[0],       RT_ELEMENTS(g_aArgsEMInterpretInstructionCPU),       REMFNDESC_FLAGS_RET_INT,    sizeof(int),        NULL },
     1298    { "EMInterpretInstructionCPU",              VMM_FN(EMInterpretInstructionCPU),      &g_aArgsEMInterpretInstructionCPU[0],       RT_ELEMENTS(g_aArgsEMInterpretInstructionCPU),         REMFNDESC_FLAGS_RET_INT,    sizeof(int),        NULL },
    12981299//    { "",                        VMM_FN(),                &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_INT,    sizeof(int),   NULL },
    12991300};
  • trunk/src/recompiler/VBoxRecompiler.c

    r38326 r38838  
    39223922        return remR3DisasEnableStepping(pVM, fEnable);
    39233923
    3924     rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)remR3DisasEnableStepping, 2, pVM, fEnable);
     3924    rc = VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)remR3DisasEnableStepping, 2, pVM, fEnable);
    39253925    AssertRC(rc);
    39263926    return rc;
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