VirtualBox

Changeset 32102 in vbox for trunk/src/VBox/VMM/FTM.cpp


Ignore:
Timestamp:
Aug 30, 2010 2:49:44 PM (14 years ago)
Author:
vboxsync
Message:

FT updates

File:
1 edited

Legend:

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

    r32096 r32102  
    117117    AssertRCReturn(rc, rc);
    118118
    119     STAM_REL_REG(pVM, &pVM->ftm.s.StatReceivedMem,               STAMTYPE_COUNTER, "/FT/Received/Mem",                   STAMUNIT_BYTES, "The amount of memory pages that was received.");
    120     STAM_REL_REG(pVM, &pVM->ftm.s.StatReceivedState,             STAMTYPE_COUNTER, "/FT/Received/State",                 STAMUNIT_BYTES, "The amount of state information that was received.");
    121     STAM_REL_REG(pVM, &pVM->ftm.s.StatSentMem,                   STAMTYPE_COUNTER, "/FT/Sent/Mem",                       STAMUNIT_BYTES, "The amount of memory pages that was sent.");
    122     STAM_REL_REG(pVM, &pVM->ftm.s.StatSentState,                 STAMTYPE_COUNTER, "/FT/Sent/State",                     STAMUNIT_BYTES, "The amount of state information that was sent.");
     119    /*
     120     * Register statistics.
     121     */
     122    STAM_REL_REG(pVM, &pVM->ftm.s.StatReceivedMem,               STAMTYPE_COUNTER, "/FT/Received/Mem",                  STAMUNIT_BYTES, "The amount of memory pages that was received.");
     123    STAM_REL_REG(pVM, &pVM->ftm.s.StatReceivedState,             STAMTYPE_COUNTER, "/FT/Received/State",                STAMUNIT_BYTES, "The amount of state information that was received.");
     124    STAM_REL_REG(pVM, &pVM->ftm.s.StatSentMem,                   STAMTYPE_COUNTER, "/FT/Sent/Mem",                      STAMUNIT_BYTES, "The amount of memory pages that was sent.");
     125    STAM_REL_REG(pVM, &pVM->ftm.s.StatSentState,                 STAMTYPE_COUNTER, "/FT/Sent/State",                    STAMUNIT_BYTES, "The amount of state information that was sent.");
     126    STAM_REL_REG(pVM, &pVM->ftm.s.StatDeltaVM,                   STAMTYPE_COUNTER, "/FT/Sync/DeltaVM",                  STAMUNIT_OCCURENCES, "Number of delta vm syncs.");
     127    STAM_REL_REG(pVM, &pVM->ftm.s.StatFullSync,                  STAMTYPE_COUNTER, "/FT/Sync/Full",                     STAMUNIT_OCCURENCES, "Number of full vm syncs.");
     128    STAM_REL_REG(pVM, &pVM->ftm.s.StatDeltaMem,                  STAMTYPE_COUNTER, "/FT/Sync/DeltaMem",                 STAMUNIT_OCCURENCES, "Number of delta mem syncs.");
    123129
    124130    return VINF_SUCCESS;
     
    578584
    579585/**
     586 * VMR3ReqCallWait callback
     587 *
     588 * @param   pVM         The VM handle.
     589 *
     590 */
     591static DECLCALLBACK(void) ftmR3WriteProtectMemory(PVM pVM)
     592{
     593    int rc = PGMR3PhysWriteProtectRAM(pVM);
     594    AssertRC(rc);
     595}
     596
     597/**
    580598 * Sync the VM state partially or fully
    581599 *
     
    584602 * @param   enmState    Which state to sync
    585603 */
    586 static DECLCALLBACK(void) ftmR3PerformSync(PVM pVM, FTMSYNCSTATE enmState)
     604static int ftmR3PerformSync(PVM pVM, FTMSYNCSTATE enmState)
    587605{
    588606    int rc;
     
    592610    {
    593611        rc = VMR3Suspend(pVM);
    594         AssertReturnVoid(RT_SUCCESS(rc));
     612        AssertRCReturn(rc, rc);
    595613    }
    596614
     
    604622        bool fSuspended = false;
    605623
     624        STAM_REL_COUNTER_INC((fFullSync) ? &pVM->ftm.s.StatFullSync : &pVM->ftm.s.StatDeltaVM);
     625
    606626        rc = ftmR3TcpSubmitCommand(pVM, (fFullSync) ? "full-sync" : "checkpoint");
    607627        AssertRC(rc);
     
    619639    case FTMSYNCSTATE_DELTA_MEMORY:
    620640        /* Nothing to do as we sync the memory in an async thread; no need to block EMT. */
     641        STAM_REL_COUNTER_INC(&pVM->ftm.s.StatDeltaMem);
    621642        break;
    622643    }
     644
    623645    /* Write protect all memory. */
    624     rc = PGMR3PhysWriteProtectRAM(pVM);
    625     AssertRC(rc);
     646    rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)ftmR3WriteProtectMemory, 1, pVM);
     647    AssertRCReturn(rc, rc);
    626648
    627649    if (enmState != FTMSYNCSTATE_DELTA_MEMORY)
    628650    {
    629651        rc = VMR3Resume(pVM);
    630         AssertRC(rc);
    631     }
     652        AssertRCReturn(rc, rc);
     653    }
     654    return VINF_SUCCESS;
    632655}
    633656
     
    725748     */
    726749
    727     rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)ftmR3PerformSync, 2, pVM, FTMSYNCSTATE_FULL);
    728     AssertRC(rc);
     750    rc = ftmR3PerformSync(pVM, FTMSYNCSTATE_FULL);
    729751
    730752    for (;;)
     
    743765
    744766            /* sync the changed memory with the standby node. */
    745             rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)ftmR3PerformSync, 2, pVM, FTMSYNCSTATE_DELTA_MEMORY);
    746             AssertRC(rc);
     767            rc = ftmR3PerformSync(pVM, FTMSYNCSTATE_DELTA_MEMORY);
    747768
    748769            /* Enumerate all dirty pages and send them to the standby VM. */
     
    10451066VMMR3DECL(int) FTMR3SyncState(PVM pVM)
    10461067{
     1068    VM_ASSERT_OTHER_THREAD(pVM);
     1069
    10471070    if (!pVM->fFaultTolerantMaster)
    10481071        return VINF_SUCCESS;
     
    10601083
    10611084    /* Sync state + changed memory with the standby node. */
    1062     rc = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)ftmR3PerformSync, 2, pVM, FTMSYNCSTATE_DELTA_VM);
    1063     AssertRC(rc);
     1085    rc = ftmR3PerformSync(pVM, FTMSYNCSTATE_DELTA_VM);
    10641086
    10651087    PDMCritSectLeave(&pVM->ftm.s.CritSect);
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