VirtualBox

Changeset 23905 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Oct 20, 2009 3:02:15 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53706
Message:

SSM: Moved the LivePrep phase to the worker thread.

File:
1 edited

Legend:

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

    r23895 r23905  
    47514751    pSSM->rc = VINF_SUCCESS;
    47524752    pSSM->enmOp = SSMSTATE_LIVE_EXEC;
    4753     for (PSSMUNIT pUnit = pVM->ssm.s.pHead;
    4754          /** @todo VMR3GetState(pVM) == VMSTATE_LIVE_SAVING &&*/ pUnit;
    4755          pUnit = pUnit->pNext)
     4753    for (PSSMUNIT pUnit = pVM->ssm.s.pHead; pUnit; pUnit = pUnit->pNext)
    47564754    {
    47574755        /*
     
    48674865
    48684866
    4869 
    4870 /**
    4871  * Continue a live state saving operation on the worker thread.
    4872  *
    4873  * @returns VBox status.
    4874  *
    4875  * @param   pSSM            The SSM handle returned by SSMR3LiveSave.
    4876  *
    4877  * @thread  Non-EMT thread. Will involve the EMT at the end of the operation.
    4878  */
    4879 VMMR3_INT_DECL(int) SSMR3LiveDoStep1(PSSMHANDLE pSSM)
    4880 {
    4881     LogFlow(("SSMR3LiveDoStep1: pSSM=%p\n", pSSM));
    4882 
    4883     /*
    4884      * Validate input.
    4885      */
    4886     AssertPtrReturn(pSSM, VERR_INVALID_POINTER);
    4887     PVM pVM = pSSM->pVM;
    4888     VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    4889     VM_ASSERT_OTHER_THREAD(pVM);
    4890     AssertMsgReturn(   pSSM->enmAfter == SSMAFTER_DESTROY
    4891                     || pSSM->enmAfter == SSMAFTER_CONTINUE
    4892                     || pSSM->enmAfter == SSMAFTER_TELEPORT,
    4893                     ("%d\n", pSSM->enmAfter),
    4894                     VERR_INVALID_PARAMETER);
    4895     AssertMsgReturn(pSSM->enmOp == SSMSTATE_LIVE_STEP1, ("%d\n", pSSM->enmOp), VERR_INVALID_STATE);
    4896     AssertRCReturn(pSSM->rc, pSSM->rc);
    4897 
     4867/**
     4868 * Implements the live exec+vote loop.
     4869 *
     4870 * @returns VBox status code (no need to check pSSM->rc).
     4871 * @param   pVM                 The VM handle.
     4872 * @param   pSSM                The saved state handle.
     4873 */
     4874static int ssmR3DoLiveExecVoteLoop(PVM pVM, PSSMHANDLE pSSM)
     4875{
    48984876    /*
    48994877     * Calc the max saved state size before we should give up because of insane
     
    49634941            }
    49644942        }
    4965 #if 0 /** @todo check this out... */
    4966         /*
    4967          * Check the VM state to see if it has changed.
    4968          */
    4969         VMSTATE enmState = VMR3GetState(pVM);
    4970         if (enmState != VMSTATE_LIVE_SAVING)
    4971         {
    4972             switch (enmState)
    4973             {
    4974                 case VMSTATE_LIVE_CANCELLED:
    4975                     LogRel(("SSM: Cancelled\n"));
    4976                     return pSSM->rc = VERR_SSM_LIVE_CANCELLED;
    4977                 case VMSTATE_LIVE_POWERED_OFF:
    4978                     LogRel(("SSM: Powered off, no state to save, aborting.\n"));
    4979                     return pSSM->rc = VERR_SSM_LIVE_POWERED_OFF;
    4980                 case VMSTATE_GURU_MEDITATION:
    4981                     LogRel(("SSM: Guru meditation, aborting.\n"));
    4982                     return pSSM->rc = VERR_SSM_LIVE_GURU_MEDITATION;
    4983                 default:
    4984                     LogRel(("SSM: Invalid VM state transition: %d->%d\n", VMSTATE_LIVE_SAVING, enmState));
    4985                     return pSSM->rc = VERR_INTERNAL_ERROR_3;
    4986             }
    4987         }
    4988 #endif
    49894943    }
    49904944
     
    50585012
    50595013/**
     5014 * Continue a live state saving operation on the worker thread.
     5015 *
     5016 * @returns VBox status.
     5017 *
     5018 * @param   pSSM            The SSM handle returned by SSMR3LiveSave.
     5019 *
     5020 * @thread  Non-EMT thread. Will involve the EMT at the end of the operation.
     5021 */
     5022VMMR3_INT_DECL(int) SSMR3LiveDoStep1(PSSMHANDLE pSSM)
     5023{
     5024    LogFlow(("SSMR3LiveDoStep1: pSSM=%p\n", pSSM));
     5025
     5026    /*
     5027     * Validate input.
     5028     */
     5029    AssertPtrReturn(pSSM, VERR_INVALID_POINTER);
     5030    PVM pVM = pSSM->pVM;
     5031    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
     5032    VM_ASSERT_OTHER_THREAD(pVM);
     5033    AssertMsgReturn(   pSSM->enmAfter == SSMAFTER_DESTROY
     5034                    || pSSM->enmAfter == SSMAFTER_CONTINUE
     5035                    || pSSM->enmAfter == SSMAFTER_TELEPORT,
     5036                    ("%d\n", pSSM->enmAfter),
     5037                    VERR_INVALID_PARAMETER);
     5038    AssertMsgReturn(pSSM->enmOp == SSMSTATE_LIVE_STEP1, ("%d\n", pSSM->enmOp), VERR_INVALID_STATE);
     5039    AssertRCReturn(pSSM->rc, pSSM->rc);
     5040
     5041    /*
     5042     * Do the prep run, then the exec+vote cycle.
     5043     */
     5044    int rc = ssmR3DoLivePrepRun(pVM, pSSM);
     5045    if (RT_SUCCESS(rc))
     5046        rc = ssmR3DoLiveExecVoteLoop(pVM, pSSM);
     5047    return rc;
     5048}
     5049
     5050
     5051/**
    50605052 * Start saving the live state.
    50615053 *
     
    51305122    if (RT_SUCCESS(rc))
    51315123    {
    5132 /** @todo If it turns out we don't need to do ssmR3DoLivePrepRun on EMT0,
    5133  *        simply move the code to SSMR3LiveDoStep1.
    5134  *  Update: This is certinaly the case, move it. */
    5135         rc = ssmR3DoLivePrepRun(pVM, pSSM);
    5136         if (RT_SUCCESS(rc))
    5137         {
    5138             /*
    5139              * Return and let the requstor thread do the pfnLiveExec/Vote part
    5140              * via SSMR3SaveFinishLive
    5141              */
    5142             pSSM->enmOp = SSMSTATE_LIVE_STEP1;
    5143             ssmR3SetCancellable(pVM, pSSM, true);
    5144             *ppSSM = pSSM;
    5145             return VINF_SUCCESS;
    5146         }
     5124        /*
     5125         * Return and let the requstor thread do the pfnLiveExec/Vote part
     5126         * via SSMR3SaveFinishLive
     5127         */
     5128        pSSM->enmOp = SSMSTATE_LIVE_STEP1;
     5129        ssmR3SetCancellable(pVM, pSSM, true);
     5130        *ppSSM = pSSM;
     5131        return VINF_SUCCESS;
    51475132    }
    51485133    /* bail out. */
     
    51545139}
    51555140
    5156 
    5157 VMMR3DECL(int) SSMR3LiveToRemote(PVM pVM, PFNVMPROGRESS pfnProgress, void *pvUser /*,
    5158                                  invent stream interface and stuff */)
    5159 {
    5160     return VERR_NOT_IMPLEMENTED;
    5161 }
    51625141
    51635142
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