VirtualBox

Changeset 51852 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Jul 3, 2014 3:09:01 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
94703
Message:

TM: Add the same TSC offset to each VCPU when pausing/resuming (not yet enabled).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/TM.cpp

    r46420 r51852  
    163163
    164164
     165//#define SYNC_TSC_PAUSE
    165166/*******************************************************************************
    166167*   Internal Functions                                                         *
     
    698699    STAM_REG(pVM, &pVM->tm.s.StatTSCSet,                              STAMTYPE_COUNTER, "/TM/TSC/Sets",                        STAMUNIT_OCCURENCES, "Calls to TMCpuTickSet.");
    699700    STAM_REG(pVM, &pVM->tm.s.StatTSCUnderflow,                        STAMTYPE_COUNTER, "/TM/TSC/Underflow",                   STAMUNIT_OCCURENCES, "TSC underflow; corrected with last seen value .");
     701    STAM_REG(pVM, &pVM->tm.s.StatVirtualPause,                        STAMTYPE_COUNTER, "/TM/TSC/Pause",                       STAMUNIT_OCCURENCES, "The number of times the TSC was paused.");
     702    STAM_REG(pVM, &pVM->tm.s.StatVirtualResume,                       STAMTYPE_COUNTER, "/TM/TSC/Resume",                      STAMUNIT_OCCURENCES, "The number of times the TSC was resumed.");
    700703#endif /* VBOX_WITH_STATISTICS */
    701704
     
    11541157    Assert(!pVM->tm.s.cVirtualTicking);
    11551158    Assert(!pVM->tm.s.fVirtualSyncTicking);
     1159    Assert(!pVM->tm.s.cTSCsTicking);
    11561160#endif
    11571161
     
    12051209    Assert(!pVM->tm.s.cVirtualTicking);
    12061210    Assert(!pVM->tm.s.fVirtualSyncTicking);
     1211    Assert(!pVM->tm.s.cTSCsTicking);
    12071212#endif
    12081213
     
    12201225     */
    12211226    pVM->tm.s.cVirtualTicking = 0;
     1227    pVM->tm.s.cTSCsTicking    = 0;
    12221228    /* the virtual clock. */
    12231229    uint64_t u64Hz;
     
    26762682    /*
    26772683     * Pause the TSC last since it is normally linked to the virtual
    2678      * sync clock, so the above code may actually stop both clock.
    2679      */
    2680     rc = tmCpuTickPause(pVCpu);
    2681     if (RT_FAILURE(rc))
    2682         return rc;
     2684     * sync clock, so the above code may actually stop both clocks.
     2685     */
     2686    if (!pVM->tm.s.fTSCTiedToExecution)
     2687    {
     2688#ifdef SYNC_TSC_PAUSE
     2689        TM_LOCK_TIMERS(pVM);    /* Paranoia: Exploiting the timer lock here. */
     2690        rc = tmCpuTickPauseLocked(pVM, pVCpu);
     2691        TM_UNLOCK_TIMERS(pVM);
     2692#else
     2693        rc = tmCpuTickPause(pVCpu);
     2694#endif
     2695        if (RT_FAILURE(rc))
     2696            return rc;
     2697    }
    26832698
    26842699#ifndef VBOX_WITHOUT_NS_ACCOUNTING
     
    27242739    if (!pVM->tm.s.fTSCTiedToExecution)
    27252740    {
     2741#ifdef SYNC_TSC_PAUSE
     2742        TM_LOCK_TIMERS(pVM);                    /* Paranoia: Exploiting the timer lock here. */
     2743        rc = tmCpuTickResumeLocked(pVM, pVCpu);
     2744        TM_UNLOCK_TIMERS(pVM);
     2745#else
    27262746        rc = tmCpuTickResume(pVM, pVCpu);
     2747#endif
    27272748        if (RT_FAILURE(rc))
    27282749            return rc;
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