VirtualBox

Changeset 24938 in vbox for trunk/src


Ignore:
Timestamp:
Nov 25, 2009 11:04:36 AM (15 years ago)
Author:
vboxsync
Message:

EM: VINF_EM_SUSPEND should have higher priority than VINF_EM_RESET since EMR3Reset takes care of the important work now.

File:
1 edited

Legend:

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

    r23211 r24938  
    8585static DECLCALLBACK(int) emR3Save(PVM pVM, PSSMHANDLE pSSM);
    8686static DECLCALLBACK(int) emR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
     87static const char *emR3GetStateName(EMSTATE enmState);
    8788static int emR3Debug(PVM pVM, PVMCPU pVCpu, int rc);
    8889static int emR3RemStep(PVM pVM, PVMCPU pVCpu);
     
    449450        PVMCPU pVCpu = &pVM->aCpus[i];
    450451        pVCpu->em.s.fForceRAW = false;
     452
     453        /* VMR3Reset may return VINF_EM_RESET or VINF_EM_SUSPEND, so transition
     454           out of the HALTED state here so that enmPrevState doesn't end up as
     455           HALTED when EMR3Execute returns. */
     456        if (pVCpu->em.s.enmState == EMSTATE_HALTED)
     457        {
     458            Log(("EMR3Reset: Cpu#%u %s -> %s\n", i, emR3GetStateName(pVCpu->em.s.enmState), i == 0 ? "EMSTATE_NONE" : "EMSTATE_WAIT_SIPI"));
     459            pVCpu->em.s.enmState = i == 0 ? EMSTATE_NONE : EMSTATE_WAIT_SIPI;
     460        }
    451461    }
    452462}
     
    581591 * @param   enmState    The state.
    582592 */
    583 VMMR3DECL(const char *) EMR3GetStateName(EMSTATE enmState)
     593static const char *emR3GetStateName(EMSTATE enmState)
    584594{
    585595    switch (enmState)
     
    16381648VMMR3DECL(int) EMR3ExecuteVM(PVM pVM, PVMCPU pVCpu)
    16391649{
    1640     LogFlow(("EMR3ExecuteVM: pVM=%p enmVMState=%d  enmState=%d (%s) fForceRAW=%d\n", pVM, pVM->enmVMState,
    1641              pVCpu->em.s.enmState, EMR3GetStateName(pVCpu->em.s.enmState), pVCpu->em.s.fForceRAW));
     1650    Log(("EMR3ExecuteVM: pVM=%p enmVMState=%d (%s)  enmState=%d (%s) enmPrevState=%d (%s) fForceRAW=%RTbool\n",
     1651         pVM,
     1652         pVM->enmVMState,          VMR3GetStateName(pVM->enmVMState),
     1653         pVCpu->em.s.enmState,     emR3GetStateName(pVCpu->em.s.enmState),
     1654         pVCpu->em.s.enmPrevState, emR3GetStateName(pVCpu->em.s.enmPrevState),
     1655         pVCpu->em.s.fForceRAW));
    16421656    VM_ASSERT_EMT(pVM);
    16431657    AssertMsg(   pVCpu->em.s.enmState == EMSTATE_NONE
    16441658              || pVCpu->em.s.enmState == EMSTATE_WAIT_SIPI
    16451659              || pVCpu->em.s.enmState == EMSTATE_SUSPENDED,
    1646               ("%s\n", EMR3GetStateName(pVCpu->em.s.enmState)));
     1660              ("%s\n", emR3GetStateName(pVCpu->em.s.enmState)));
    16471661
    16481662    int rc = setjmp(pVCpu->em.s.u.FatalLongJump);
     
    17611775                {
    17621776                    EMSTATE enmState = emR3Reschedule(pVM, pVCpu, pVCpu->em.s.pCtx);
    1763                     Log2(("EMR3ExecuteVM: VINF_EM_RESCHEDULE: %d -> %d (%s)\n", pVCpu->em.s.enmState, enmState, EMR3GetStateName(enmState)));
     1777                    Log2(("EMR3ExecuteVM: VINF_EM_RESCHEDULE: %d -> %d (%s)\n", pVCpu->em.s.enmState, enmState, emR3GetStateName(enmState)));
    17641778                    pVCpu->em.s.enmState = enmState;
    17651779                    break;
     
    18021816                    {
    18031817                        EMSTATE enmState = emR3Reschedule(pVM, pVCpu, pVCpu->em.s.pCtx);
    1804                         Log2(("EMR3ExecuteVM: VINF_EM_RESET: %d -> %d (%s)\n", pVCpu->em.s.enmState, enmState, EMR3GetStateName(enmState)));
     1818                        Log2(("EMR3ExecuteVM: VINF_EM_RESET: %d -> %d (%s)\n", pVCpu->em.s.enmState, enmState, emR3GetStateName(enmState)));
    18051819                        pVCpu->em.s.enmState = enmState;
    18061820                    }
     
    18401854                case VINF_EM_NO_MEMORY:
    18411855                    Log2(("EMR3ExecuteVM: VINF_EM_NO_MEMORY: %d -> %d\n", pVCpu->em.s.enmState, EMSTATE_SUSPENDED));
     1856                    pVCpu->em.s.enmPrevState = pVCpu->em.s.enmState;
    18421857                    pVCpu->em.s.enmState = EMSTATE_SUSPENDED;
    18431858                    TMR3NotifySuspend(pVM, pVCpu);
     
    19081923                        rc = VERR_EM_INTERNAL_ERROR;
    19091924                    }
     1925                    Log(("EMR3ExecuteVM: %Rrc: %d -> %d (EMSTATE_GURU_MEDITATION)\n", rc, pVCpu->em.s.enmState, EMSTATE_GURU_MEDITATION));
    19101926                    pVCpu->em.s.enmState = EMSTATE_GURU_MEDITATION;
    1911                     Log(("EMR3ExecuteVM returns %d\n", rc));
    19121927                    break;
    19131928            }
     
    19751990                    TMR3NotifySuspend(pVM, pVCpu);
    19761991                    STAM_REL_PROFILE_ADV_STOP(&pVCpu->em.s.StatTotal, x);
     1992                    Log(("EMR3ExecuteVM: actually returns %Rrc (state %s / %s)\n", rc, emR3GetStateName(pVCpu->em.s.enmState), emR3GetStateName(pVCpu->em.s.enmPrevState)));
    19771993                    return VINF_EM_SUSPEND;
    19781994
     
    20032019                        pVCpu->em.s.enmState = EMSTATE_GURU_MEDITATION;
    20042020                        VMMR3FatalDump(pVM, pVCpu, rc);
     2021                        Log(("EMR3ExecuteVM: actually returns %Rrc (state %s / %s)\n", rc, emR3GetStateName(pVCpu->em.s.enmState), emR3GetStateName(pVCpu->em.s.enmPrevState)));
    20052022                        return rc;
    20062023                    }
     
    20202037                    emR3Debug(pVM, pVCpu, rc);
    20212038                    STAM_REL_PROFILE_ADV_STOP(&pVCpu->em.s.StatTotal, x);
     2039                    Log(("EMR3ExecuteVM: actually returns %Rrc (state %s / %s)\n", rc, emR3GetStateName(pVCpu->em.s.enmState), emR3GetStateName(pVCpu->em.s.enmPrevState)));
    20222040                    return rc;
    20232041                }
     
    20332051                    TMR3NotifySuspend(pVM, pVCpu);
    20342052                    STAM_REL_PROFILE_ADV_STOP(&pVCpu->em.s.StatTotal, x);
     2053                    Log(("EMR3ExecuteVM: actually returns %Rrc (state %s / %s)\n", rc, emR3GetStateName(pVCpu->em.s.enmState), emR3GetStateName(pVCpu->em.s.enmPrevState)));
    20352054                    return VERR_EM_INTERNAL_ERROR;
    20362055            }
     
    20422061         * Fatal error.
    20432062         */
    2044         LogFlow(("EMR3ExecuteVM: returns %Rrc (longjmp / fatal error)\n", rc));
     2063        Log(("EMR3ExecuteVM: returns %Rrc because of longjmp / fatal error; (state %s / %s)\n", rc, emR3GetStateName(pVCpu->em.s.enmState), emR3GetStateName(pVCpu->em.s.enmPrevState)));
    20452064        TMR3NotifySuspend(pVM, pVCpu);
    20462065        VMMR3FatalDump(pVM, pVCpu, 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