VirtualBox

Changeset 61935 in vbox for trunk/src


Ignore:
Timestamp:
Jun 29, 2016 1:51:13 PM (8 years ago)
Author:
vboxsync
Message:

MachineDebuggerImpl.cpp: VMR3Suspend will fail if the VM is already suspended! The intention was actually to put the pause in the caller code (terminateVmBySession), rather than here. But, for reliablity, let's keep it, but restrict it to only kick in when actually needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp

    r61786 r61935  
    13591359    if (SUCCEEDED(hrc))
    13601360    {
    1361         /* Suspend the VM first or we risk deadlocks or inconsistent guest stacks. */
    1362         alock.release();
    1363         int vrc = VMR3Suspend(ptrVM.rawUVM(), VMSUSPENDREASON_USER);
    1364         alock.acquire();
     1361        /*
     1362         * There is currently a problem with the windows diggers and SMP, where
     1363         * guest driver memory is being read from CPU zero in order to ensure that
     1364         * we've got a consisten virtual memory view.  If one of the other CPUs
     1365         * initiates a rendezvous while we're unwinding the stack and trying to
     1366         * read guest driver memory, we will deadlock.
     1367         *
     1368         * So, check the VM state and maybe suspend the VM before we continue.
     1369         */
     1370        int  vrc     = VINF_SUCCESS;
     1371        bool fPaused = false;
     1372        if (aCpuId != 0)
     1373        {
     1374            VMSTATE enmVmState = VMR3GetStateU(ptrVM.rawUVM());
     1375            if (   enmVmState == VMSTATE_RUNNING
     1376                || enmVmState == VMSTATE_RUNNING_LS
     1377                || enmVmState == VMSTATE_RUNNING_FT)
     1378            {
     1379                alock.release();
     1380                vrc = VMR3Suspend(ptrVM.rawUVM(), VMSUSPENDREASON_USER);
     1381                alock.acquire();
     1382                fPaused = RT_SUCCESS(vrc);
     1383            }
     1384        }
    13651385        if (RT_SUCCESS(vrc))
    13661386        {
    13671387            PCDBGFSTACKFRAME pFirstFrame;
    1368 
    13691388            vrc = DBGFR3StackWalkBegin(ptrVM.rawUVM(), aCpuId, DBGFCODETYPE_GUEST, &pFirstFrame);
    13701389            if (RT_SUCCESS(vrc))
     
    14561475                hrc = setError(E_FAIL, tr("DBGFR3StackWalkBegin failed with %Rrc"), vrc);
    14571476
    1458             alock.release();
    1459             VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_USER);
    1460             alock.acquire();
     1477            /*
     1478             * Resume the VM if we suspended it.
     1479             */
     1480            if (fPaused)
     1481            {
     1482                alock.release();
     1483                VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_USER);
     1484            }
    14611485        }
    14621486        else
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