VirtualBox

Changeset 2611 in vbox


Ignore:
Timestamp:
May 14, 2007 4:58:51 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
21124
Message:

UCTOffset (ns).

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

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

    r2584 r2611  
    2626 * device and drivers.
    2727 *
    28  * 
     28 *
    2929 * @section sec_tm_clocks   Clocks
    30  * 
     30 *
    3131 * There are currently 4 clocks:
    3232 *   - Virtual (guest).
    3333 *   - Synchronous virtual (guest).
    34  *   - CPU Tick (TSC) (guest). Only current use is rdtsc emulation. Usually a 
     34 *   - CPU Tick (TSC) (guest). Only current use is rdtsc emulation. Usually a
    3535 *     function of the virtual clock.
    36  *   - Real (host). The only current use is display updates for not real 
     36 *   - Real (host). The only current use is display updates for not real
    3737 *     good reason...
    38  * 
    39  * The interesting clocks are two first ones, the virtual and synchronous virtual 
    40  * clock. The synchronous virtual clock is tied to the virtual clock except that 
     38 *
     39 * The interesting clocks are two first ones, the virtual and synchronous virtual
     40 * clock. The synchronous virtual clock is tied to the virtual clock except that
    4141 * it will take into account timer delivery lag caused by host scheduling. It will
    4242 * normally never advance beyond the header timer, and when lagging too far behind
    4343 * it will gradually speed up to catch up with the virtual clock.
    4444 *
    45  * The CPU tick (TSC) is normally virtualized as a function of the virtual time, 
     45 * The CPU tick (TSC) is normally virtualized as a function of the virtual time,
    4646 * where the frequency defaults to the host cpu frequency (as we measure it). It
    4747 * can also use the host TSC as source and either present it with an offset or
    48  * unmodified. It is of course possible to configure the TSC frequency and mode 
     48 * unmodified. It is of course possible to configure the TSC frequency and mode
    4949 * of operation.
    50  * 
     50 *
    5151 * @subsection subsec_tm_timesync Guest Time Sync / UTC time
    52  * 
     52 *
    5353 * Guest time syncing is primarily taken care of by the VMM device. The principle
    54  * is very simple, the guest additions periodically asks the VMM device what the 
    55  * current UTC time is and makes adjustments accordingly. Now, because the 
     54 * is very simple, the guest additions periodically asks the VMM device what the
     55 * current UTC time is and makes adjustments accordingly. Now, because the
    5656 * synchronous virtual clock might be doing catchups and we would therefore
    5757 * deliver more than the normal rate for a little while, some adjusting of the
    58  * UTC time is required before passing it on to the guest. This is why TM provides 
     58 * UTC time is required before passing it on to the guest. This is why TM provides
    5959 * an API for query the current UTC time.
    6060 *
    61  * 
     61 *
    6262 * @section sec_tm_timers   Timers
    6363 *
    6464 * The timers can use any of the TM clocks described in the previous section. Each
    6565 * clock has its own scheduling facility, or timer queue if you like. There are
    66  * a few factors which makes it a bit complex. First there is the usual R0 vs R3 
     66 * a few factors which makes it a bit complex. First there is the usual R0 vs R3
    6767 * vs. GC thing. Then there is multiple threads, and then there is the timer thread
    68  * that periodically checks whether any timers has expired without EMT noticing. On 
     68 * that periodically checks whether any timers has expired without EMT noticing. On
    6969 * the API level, all but the create and save APIs must be mulithreaded. EMT will
    7070 * always run the timers.
    7171 *
    7272 * The design is using a doubly linked list of active timers which is ordered
    73  * by expire date. This list is only modified by the EMT thread. Updates to the 
    74  * list are are batched in a singly linked list, which is then process by the EMT 
    75  * thread at the first opportunity (immediately, next time EMT modifies a timer 
     73 * by expire date. This list is only modified by the EMT thread. Updates to the
     74 * list are are batched in a singly linked list, which is then process by the EMT
     75 * thread at the first opportunity (immediately, next time EMT modifies a timer
    7676 * on that clock, or next timer timeout). Both lists are offset based and all
    7777 * the elements therefore allocated from the hyper heap.
     
    8383 *    - Poll the virtual clocks and calculate first timeout from the halt loop.
    8484 *    - Employ a thread which periodically (100Hz) polls all the timer queues.
    85  * 
    86  * 
     85 *
     86 *
    8787 * @section sec_tm_timer    Logging
    88  * 
     88 *
    8989 * Level 2: Logs a most of the timer state transitions and queue servicing.
    9090 * Level 3: Logs a few oddments.
    9191 * Level 4: Logs TMCLOCK_VIRTUAL_SYNC catch-up events.
    92  * 
     92 *
    9393 */
    9494
     
    241241        pVM->tm.s.fTSCVirtualized = true; /* trap rdtsc */
    242242    else if (VBOX_FAILURE(rc))
    243         return VMSetError(pVM, rc, RT_SRC_POS, 
    244                           N_("Configuration error: Failed to querying bool value \"UseRealTSC\". (%Vrc)"), rc); 
     243        return VMSetError(pVM, rc, RT_SRC_POS,
     244                          N_("Configuration error: Failed to querying bool value \"UseRealTSC\". (%Vrc)"), rc);
    245245
    246246    /* source */
     
    249249        pVM->tm.s.fTSCUseRealTSC = false; /* use virtual time */
    250250    else if (VBOX_FAILURE(rc))
    251         return VMSetError(pVM, rc, RT_SRC_POS, 
    252                           N_("Configuration error: Failed to querying bool value \"UseRealTSC\". (%Vrc)"), rc); 
     251        return VMSetError(pVM, rc, RT_SRC_POS,
     252                          N_("Configuration error: Failed to querying bool value \"UseRealTSC\". (%Vrc)"), rc);
    253253    if (!pVM->tm.s.fTSCUseRealTSC)
    254254        pVM->tm.s.fTSCVirtualized = true;
     
    277277    }
    278278    else if (VBOX_FAILURE(rc))
    279         return VMSetError(pVM, rc, RT_SRC_POS, 
    280                           N_("Configuration error: Failed to querying uint64_t value \"TSCTicksPerSecond\". (%Vrc)"), rc); 
     279        return VMSetError(pVM, rc, RT_SRC_POS,
     280                          N_("Configuration error: Failed to querying uint64_t value \"TSCTicksPerSecond\". (%Vrc)"), rc);
    281281    else if (   pVM->tm.s.cTSCTicksPerSecond < _1M
    282282             || pVM->tm.s.cTSCTicksPerSecond >= _4G)
    283         return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 
     283        return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
    284284                          N_("Configuration error: \"TSCTicksPerSecond\" = %RI64 is not in the range 1MHz..4GHz-1!"),
    285285                          pVM->tm.s.cTSCTicksPerSecond);
     
    295295    else
    296296        CPUMR3SetCR4Feature(pVM, 0, ~X86_CR4_TSD);
    297     LogRel(("TM: cTSCTicksPerSecond=%#RX64 (%RU64) fTSCVirtualized=%RTbool fTSCUseRealTSC=%RTbool fMaybeUseOffsettedHostTSC=%RTbool\n", 
    298             pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.fTSCVirtualized, 
     297    LogRel(("TM: cTSCTicksPerSecond=%#RX64 (%RU64) fTSCVirtualized=%RTbool fTSCUseRealTSC=%RTbool fMaybeUseOffsettedHostTSC=%RTbool\n",
     298            pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.fTSCVirtualized,
    299299            pVM->tm.s.fTSCUseRealTSC, pVM->tm.s.fMaybeUseOffsettedHostTSC));
    300300
     
    306306        pVM->tm.s.u32VirtualSyncScheduleSlack           =   100000; /* 0.100ms (ASSUMES virtual time is nanoseconds) */
    307307    else if (VBOX_FAILURE(rc))
    308         return VMSetError(pVM, rc, RT_SRC_POS, 
    309                           N_("Configuration error: Failed to querying 32-bit integer value \"ScheduleSlack\". (%Vrc)"), rc); 
     308        return VMSetError(pVM, rc, RT_SRC_POS,
     309                          N_("Configuration error: Failed to querying 32-bit integer value \"ScheduleSlack\". (%Vrc)"), rc);
    310310
    311311    rc = CFGMR3QueryU64(pCfgHandle, "CatchUpStopThreshold", &pVM->tm.s.u64VirtualSyncCatchUpStopThreshold);
     
    313313        pVM->tm.s.u64VirtualSyncCatchUpStopThreshold    =   500000; /* 0.5ms */
    314314    else if (VBOX_FAILURE(rc))
    315         return VMSetError(pVM, rc, RT_SRC_POS, 
    316                           N_("Configuration error: Failed to querying 64-bit integer value \"CatchUpStopThreshold\". (%Vrc)"), rc); 
     315        return VMSetError(pVM, rc, RT_SRC_POS,
     316                          N_("Configuration error: Failed to querying 64-bit integer value \"CatchUpStopThreshold\". (%Vrc)"), rc);
    317317
    318318    rc = CFGMR3QueryU64(pCfgHandle, "CatchUpGiveUpThreshold", &pVM->tm.s.u64VirtualSyncCatchUpGiveUpThreshold);
     
    320320        pVM->tm.s.u64VirtualSyncCatchUpGiveUpThreshold  = UINT64_C(60000000000); /* 60 sec */
    321321    else if (VBOX_FAILURE(rc))
    322         return VMSetError(pVM, rc, RT_SRC_POS, 
    323                           N_("Configuration error: Failed to querying 64-bit integer value \"CatchUpGiveUpThreshold\". (%Vrc)"), rc); 
     322        return VMSetError(pVM, rc, RT_SRC_POS,
     323                          N_("Configuration error: Failed to querying 64-bit integer value \"CatchUpGiveUpThreshold\". (%Vrc)"), rc);
    324324
    325325
     
    358358
    359359    /*
     360     * Configure real world time (UCT).
     361     */
     362    rc = CFGMR3QueryS64(pCfgHandle, "UCTOffset", &pVM->tm.s.offUCT);
     363    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     364        pVM->tm.s.offUCT = 0; /* ns */
     365    else if (VBOX_FAILURE(rc))
     366        return VMSetError(pVM, rc, RT_SRC_POS,
     367                          N_("Configuration error: Failed to querying 64-bit integer value \"UCTOffset\". (%Vrc)"), rc);
     368
     369    /*
    360370     * Setup the warp drive.
    361371     */
     
    366376        pVM->tm.s.u32VirtualWarpDrivePercentage = 100;
    367377    else if (VBOX_FAILURE(rc))
    368         return VMSetError(pVM, rc, RT_SRC_POS, 
    369                           N_("Configuration error: Failed to querying uint32_t value \"WarpDrivePercent\". (%Vrc)"), rc); 
    370     else if (   pVM->tm.s.u32VirtualWarpDrivePercentage < 2 
     378        return VMSetError(pVM, rc, RT_SRC_POS,
     379                          N_("Configuration error: Failed to querying uint32_t value \"WarpDrivePercent\". (%Vrc)"), rc);
     380    else if (   pVM->tm.s.u32VirtualWarpDrivePercentage < 2
    371381             || pVM->tm.s.u32VirtualWarpDrivePercentage > 20000)
    372         return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 
     382        return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
    373383                          N_("Configuration error: \"WarpDrivePercent\" = %RI32 is not in the range 2..20000!"),
    374384                          pVM->tm.s.u32VirtualWarpDrivePercentage);
     
    385395        u32Millies = 10;
    386396    else if (VBOX_FAILURE(rc))
    387         return VMSetError(pVM, rc, RT_SRC_POS, 
     397        return VMSetError(pVM, rc, RT_SRC_POS,
    388398                          N_("Configuration error: Failed to query uint32_t value \"TimerMillies\", rc=%Vrc.\n"), rc);
    389399    rc = RTTimerCreate(&pVM->tm.s.pTimer, u32Millies, tmR3TimerCallback, pVM);
     
    480490/**
    481491 * Checks if the host CPU has a fixed TSC frequency.
    482  * 
     492 *
    483493 * @returns true if it has, false if it hasn't.
    484  * 
    485  * @remark  This test doesn't bother with very old CPUs that doesn't do power 
     494 *
     495 * @remark  This test doesn't bother with very old CPUs that doesn't do power
    486496 *          management or any other stuff that might influence the TSC rate.
    487497 *          This isn't currently relevant.
     
    494504        ASMCpuId(0, &uEAX, &uEBX, &uECX, &uEDX);
    495505        if (    uEAX >= 1
    496             &&  uEBX == 0x68747541 
    497             &&  uECX == 0x444d4163 
     506            &&  uEBX == 0x68747541
     507            &&  uECX == 0x444d4163
    498508            &&  uEDX == 0x69746e65)
    499509        {
    500             /* 
     510            /*
    501511             * AuthenticAMD - Check for APM support and that TscInvariant is set.
    502512             *
    503              * This test isn't correct with respect to fixed/non-fixed TSC and 
     513             * This test isn't correct with respect to fixed/non-fixed TSC and
    504514             * older models, but this isn't relevant since the result is currently
    505515             * only used for making a descision on AMD-V models.
     
    518528                 &&  uEDX == 0x49656e69)
    519529        {
    520             /* 
     530            /*
    521531             * GenuineIntel - Check the model number.
    522              * 
     532             *
    523533             * This test is lacking in the same way and for the same reasons
    524534             * as the AMD test above.
     
    552562    uint64_t    u64Hz;
    553563    PCSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
    554     if (    pGip 
     564    if (    pGip
    555565        &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC)
    556566    {
     
    564574            if (    pGip
    565575                &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC
    566                 &&  (u64Hz = pGip->aCPUs[iCpu].u64CpuHz) 
     576                &&  (u64Hz = pGip->aCPUs[iCpu].u64CpuHz)
    567577                &&  u64Hz != ~(uint64_t)0)
    568578                return u64Hz;
     
    838848    else
    839849        pVM->tm.s.cTSCTicksPerSecond = u64Hz;
    840     LogRel(("TM: cTSCTicksPerSecond=%#RX64 (%RU64) fTSCVirtualized=%RTbool fTSCUseRealTSC=%RTbool (state load)\n", 
     850    LogRel(("TM: cTSCTicksPerSecond=%#RX64 (%RU64) fTSCVirtualized=%RTbool fTSCUseRealTSC=%RTbool (state load)\n",
    841851            pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.fTSCVirtualized, pVM->tm.s.fTSCUseRealTSC));
    842852
     
    852862/**
    853863 * Internal TMR3TimerCreate worker.
    854  * 
     864 *
    855865 * @returns VBox status code.
    856866 * @param   pVM         The VM handle.
     
    11171127DECLINLINE(bool) tmR3AnyExpiredTimers(PVM pVM)
    11181128{
    1119     /* 
     1129    /*
    11201130     * Combine the time calculation for the first two since we're not on EMT
    11211131     * TMVirtualSyncGet only permits EMT.
     
    11241134    if (pVM->tm.s.CTXALLSUFF(paTimerQueues)[TMCLOCK_VIRTUAL].u64Expire <= u64Now)
    11251135        return true;
    1126     u64Now = pVM->tm.s.fVirtualSyncTicking 
    1127            ? u64Now - pVM->tm.s.offVirtualSync 
     1136    u64Now = pVM->tm.s.fVirtualSyncTicking
     1137           ? u64Now - pVM->tm.s.offVirtualSync
    11281138           : pVM->tm.s.u64VirtualSync;
    11291139    if (pVM->tm.s.CTXALLSUFF(paTimerQueues)[TMCLOCK_VIRTUAL_SYNC].u64Expire <= u64Now)
     
    11471157 * @param   pvUser      VM handle.
    11481158 * @thread  Timer thread.
    1149  * 
     1159 *
    11501160 * @remark  We cannot do the scheduling and queues running from a timer handler
    11511161 *          since it's not executing in EMT, and even if it was it would be async
     
    12201230    tmR3TimerQueueRun(pVM, &pVM->tm.s.paTimerQueuesR3[TMCLOCK_TSC]);
    12211231    STAM_PROFILE_ADV_SUSPEND(&pVM->tm.s.StatDoQueuesRun, r3);
    1222 #endif 
     1232#endif
    12231233
    12241234    /* TMCLOCK_REAL */
     
    13191329
    13201330/**
    1321  * Schedules and runs any pending times in the timer queue for the 
     1331 * Schedules and runs any pending times in the timer queue for the
    13221332 * synchronous virtual clock.
    1323  * 
     1333 *
    13241334 * This scheduling is a bit different from the other queues as it need
    1325  * to implement the special requirements of the timer synchronous virtual 
     1335 * to implement the special requirements of the timer synchronous virtual
    13261336 * clock, thus this 2nd queue run funcion.
    13271337 *
     
    13531363     * this will be implemented at a later point if neccessary.
    13541364     *
    1355      * Without this frame we would 1) having to run timers much more frequently 
     1365     * Without this frame we would 1) having to run timers much more frequently
    13561366     * and 2) lag behind at a steady rate.
    13571367     */
     
    14171427                ||  !(u64Max <= u64VirtualNow - pVM->tm.s.offVirtualSyncGivenUp)
    14181428                ||  !(u64Now <= u64Max)))
    1419 {                   
     1429{
    14201430    AssertMsg2("Add the following to defect #1414:\n"
    14211431               "                         u64Now=%016RX64\n"
     
    14331443               "            fVirtualSyncCatchUp=%RTbool (prev=%RTbool)\n",
    14341444               u64Now,
    1435                u64Max, 
     1445               u64Max,
    14361446               pNext->u64Expire,
    14371447               u64VirtualNow,
     
    14431453               pVM->tm.s.u64VirtualSyncCatchUpPrev,
    14441454               pVM->tm.s.u32VirtualSyncCatchUpPercentage,
    1445                pVM->tm.s.fVirtualSyncTicking, 
     1455               pVM->tm.s.fVirtualSyncTicking,
    14461456               pVM->tm.s.fVirtualSyncCatchUp, fWasInCatchup);
    14471457    Assert(u64Now <= u64VirtualNow - pVM->tm.s.offVirtualSyncGivenUp);
     
    15081518
    15091519    /*
    1510      * Restart the clock if it was stopped to serve any timers, 
     1520     * Restart the clock if it was stopped to serve any timers,
    15111521     * and start/adjust catch-up if necessary.
    15121522     */
     
    15521562        Assert(!(offLag & RT_BIT_64(63)));
    15531563
    1554         /* 
    1555          * Deal with starting, adjusting and stopping catchup. 
     1564        /*
     1565         * Deal with starting, adjusting and stopping catchup.
    15561566         */
    15571567        if (pVM->tm.s.fVirtualSyncCatchUp)
     
    16151625        }
    16161626
    1617         /* 
    1618          * Update the offset and restart the clock. 
     1627        /*
     1628         * Update the offset and restart the clock.
    16191629         */
    16201630        ASMAtomicXchgU64(&pVM->tm.s.offVirtualSync, offNew);
     
    17391749    RTTimeNow(pTime);
    17401750    RTTimeSpecSubNano(pTime, pVM->tm.s.offVirtualSync - pVM->tm.s.offVirtualSyncGivenUp);
     1751    RTTimeSpecAddNano(pTime, pVM->tm.s.offUCT);
    17411752    return pTime;
    17421753}
     
    18141825                            pTimer->offPrev,
    18151826                            pTimer->offScheduleNext,
    1816                             pTimer->enmClock == TMCLOCK_REAL 
    1817                             ? "Real " 
    1818                             : pTimer->enmClock == TMCLOCK_VIRTUAL 
     1827                            pTimer->enmClock == TMCLOCK_REAL
     1828                            ? "Real "
     1829                            : pTimer->enmClock == TMCLOCK_VIRTUAL
    18191830                            ? "Virt "
    18201831                            : pTimer->enmClock == TMCLOCK_VIRTUAL_SYNC
     
    18491860    const uint64_t u64Real = TMRealGet(pVM);
    18501861
    1851     /* 
    1852      * TSC 
     1862    /*
     1863     * TSC
    18531864     */
    18541865    pHlp->pfnPrintf(pHlp,
    1855                     "Cpu Tick: %18RU64 (%#016RX64) %RU64Hz %s%s", 
     1866                    "Cpu Tick: %18RU64 (%#016RX64) %RU64Hz %s%s",
    18561867                    u64TSC, u64TSC, TMCpuTicksPerSecond(pVM),
    18571868                    pVM->tm.s.fTSCTicking ? "ticking" : "paused",
     
    18671878    pHlp->pfnPrintf(pHlp, "\n");
    18681879
    1869     /* 
    1870      * virtual 
     1880    /*
     1881     * virtual
    18711882     */
    18721883    pHlp->pfnPrintf(pHlp,
     
    18781889    pHlp->pfnPrintf(pHlp, "\n");
    18791890
    1880     /* 
    1881      * virtual sync 
     1891    /*
     1892     * virtual sync
    18821893     */
    18831894    pHlp->pfnPrintf(pHlp,
    18841895                    "VirtSync: %18RU64 (%#016RX64) %s%s",
    1885                     u64VirtualSync, u64VirtualSync, 
     1896                    u64VirtualSync, u64VirtualSync,
    18861897                    pVM->tm.s.fVirtualSyncTicking ? "ticking" : "paused",
    18871898                    pVM->tm.s.fVirtualSyncCatchUp ? " - catchup" : "");
     
    18941905    pHlp->pfnPrintf(pHlp, "\n");
    18951906
    1896     /* 
    1897      * real 
     1907    /*
     1908     * real
    18981909     */
    18991910    pHlp->pfnPrintf(pHlp,
  • trunk/src/VBox/VMM/TMInternal.h

    r2581 r2611  
    291291    /** CPU timestamp ticking enabled indicator (bool). (RDTSC) */
    292292    bool                        fTSCTicking;
    293     /** Set if we fully virtualize the TSC, i.e. intercept all rdtsc instructions. 
     293    /** Set if we fully virtualize the TSC, i.e. intercept all rdtsc instructions.
    294294     * Config variable: TSCVirtualized (bool) */
    295295    bool                        fTSCVirtualized;
    296296    /** Set if we use the real TSC as time source or if we use the virtual clock.
    297      * If fTSCVirtualized is set we maintain a offset to the TSC and pausing/resuming the 
    298      * ticking. fTSCVirtualized = false implies fTSCUseRealTSC = true. 
     297     * If fTSCVirtualized is set we maintain a offset to the TSC and pausing/resuming the
     298     * ticking. fTSCVirtualized = false implies fTSCUseRealTSC = true.
    299299     * Config variable: TSCUseRealTSC (bool) */
    300300    bool                        fTSCUseRealTSC;
     
    304304    /** The guest TSC when fTicking is cleared. */
    305305    uint64_t                    u64TSC;
    306     /** The number of CPU clock ticks per second (TMCLOCK_TSC). 
     306    /** The number of CPU clock ticks per second (TMCLOCK_TSC).
    307307     * Config variable: TSCTicksPerSecond (64-bit unsigned int)
    308308     * The config variable implies fTSCVirtualized = true and fTSCUseRealTSC = false. */
     
    317317    /** Virtual timer synchronous time catch-up active. */
    318318    bool volatile               fVirtualSyncCatchUp;
    319     /** WarpDrive percentage. 
    320      * 100% is normal (fVirtualSyncNormal == true). When other than 100% we apply 
    321      * this percentage to the raw time source for the period it's been valid in, 
     319    /** WarpDrive percentage.
     320     * 100% is normal (fVirtualSyncNormal == true). When other than 100% we apply
     321     * this percentage to the raw time source for the period it's been valid in,
    322322     * i.e. since u64VirtualWarpDriveStart. */
    323323    uint32_t                    u32VirtualWarpDrivePercentage;
     
    335335    uint64_t volatile           u64VirtualSync;
    336336    /** The offset of the timer synchronous virtual clock (TMCLOCK_VIRTUAL_SYNC) relative
    337      * to the virtual clock (TMCLOCK_VIRTUAL). 
     337     * to the virtual clock (TMCLOCK_VIRTUAL).
    338338     * (This is accessed by the timer thread and must be updated atomically.) */
    339339    uint64_t volatile           offVirtualSync;
    340     /** The offset into offVirtualSync that's been irrevocably given up by failed catch-up attempts. 
     340    /** The offset into offVirtualSync that's been irrevocably given up by failed catch-up attempts.
    341341     * Thus the current lag is offVirtualSync - offVirtualSyncGivenUp. */
    342342    uint64_t                    offVirtualSyncGivenUp;
     
    351351    /** When to give up catch-up. */
    352352    uint64_t                    u64VirtualSyncCatchUpGiveUpThreshold;
    353 /** @def TM_MAX_CATCHUP_PERIODS 
     353/** @def TM_MAX_CATCHUP_PERIODS
    354354 * The number of catchup rates. */
    355355#define TM_MAX_CATCHUP_PERIODS  10
    356     /** The agressivness of the catch-up relative to how far we've lagged behind. 
     356    /** The agressivness of the catch-up relative to how far we've lagged behind.
    357357     * The idea is to have increasing catch-up percentage as the lag increases. */
    358358    struct TMCATCHUPPERIOD
     
    363363    }                           aVirtualSyncCatchUpPeriods[TM_MAX_CATCHUP_PERIODS];
    364364
     365    /** The UCT offset in ns.
     366     * This is *NOT* for converting UTC to local time. It is for converting real
     367     * world UCT time to VM UCT time. This feature is indented for doing date
     368     * testing of software and similar.
     369     * @todo Implement warpdrive on UCT. */
     370    int64_t                     offUCT;
     371
    365372    /** Timer queues for the different clock types - R3 Ptr */
    366373    R3PTRTYPE(PTMTIMERQUEUE)    paTimerQueuesR3;
     
    412419    STAMCOUNTER                 StatPostponedGC;
    413420    /** @} */
    414     /** Read the time 
     421    /** Read the time
    415422     * @{ */
    416423    STAMCOUNTER                 StatVirtualGet;
  • trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp

    r2551 r2611  
    5050/**
    5151 * Get the time when we're not running at 100%
    52  * 
     52 *
    5353 * @returns The timestamp.
    5454 * @param   pVM     The VM handle.
     
    5656static uint64_t tmVirtualGetRawNonNormal(PVM pVM)
    5757{
    58     /* 
    59      * Recalculate the RTTimeNanoTS() value for the period where 
     58    /*
     59     * Recalculate the RTTimeNanoTS() value for the period where
    6060     * warp drive has been enabled.
    6161     */
     
    6666    u64 += pVM->tm.s.u64VirtualWarpDriveStart;
    6767
    68     /* 
    69      * Now we apply the virtual time offset. 
    70      * (Which is the negate RTTimeNanoTS() value for when the virtual machine 
     68    /*
     69     * Now we apply the virtual time offset.
     70     * (Which is the negate RTTimeNanoTS() value for when the virtual machine
    7171     * started if it had been running continuously without any suspends.)
    7272     */
     
    7878/**
    7979 * Get the raw virtual time.
    80  * 
    81  * @returns The current time stamp. 
     80 *
     81 * @returns The current time stamp.
    8282 * @param   pVM     The VM handle.
    8383 */
     
    300300/**
    301301 * Gets the current lag of the synchronous virtual clock (relative to the virtual clock).
    302  * 
     302 *
    303303 * @return  The current lag.
    304304 * @param   pVM     VM handle.
     
    312312/**
    313313 * Get the current catch-up percent.
    314  * 
     314 *
    315315 * @return  The current catch0up percent. 0 means running at the same speed as the virtual clock.
    316316 * @param   pVM     VM handle.
     
    385385/**
    386386 * Gets the current warp drive percent.
    387  * 
     387 *
    388388 * @returns The warp drive percent.
    389389 * @param   pVM         The VM handle.
     
    397397/**
    398398 * Sets the warp drive percent of the virtual time.
    399  * 
     399 *
    400400 * @returns VBox status code.
    401401 * @param   pVM         The VM handle.
     
    404404TMDECL(int) TMVirtualSetWarpDrive(PVM pVM, uint32_t u32Percent)
    405405{
     406/** @todo This isn't a feature specific to virtual time, move to TM level. (It
     407 * should affect the TMR3UCTNow as well! */
    406408#ifdef IN_RING3
    407409    PVMREQ pReq;
     
    414416
    415417    return tmVirtualSetWarpDrive(pVM, u32Percent);
    416 #endif 
     418#endif
    417419}
    418420
     
    420422/**
    421423 * EMT worker for tmVirtualSetWarpDrive.
    422  * 
     424 *
    423425 * @returns VBox status code.
    424426 * @param   pVM         The VM handle.
     
    431433     * Validate it.
    432434     */
    433     AssertMsgReturn(u32Percent >= 2 && u32Percent <= 20000, 
    434                     ("%RX32 is not between 2 and 20000 (inclusive).\n", u32Percent), 
     435    AssertMsgReturn(u32Percent >= 2 && u32Percent <= 20000,
     436                    ("%RX32 is not between 2 and 20000 (inclusive).\n", u32Percent),
    435437                    VERR_INVALID_PARAMETER);
    436438
    437     /* 
     439    /*
    438440     * If the time is running we'll have to pause it before we can change
    439441     * the warp drive settings.
     
    450452    pVM->tm.s.u32VirtualWarpDrivePercentage = u32Percent;
    451453    pVM->tm.s.fVirtualWarpDrive = u32Percent != 100;
    452     LogRel(("TM: u32VirtualWarpDrivePercentage=%RI32 fVirtualWarpDrive=%RTbool\n", 
     454    LogRel(("TM: u32VirtualWarpDrivePercentage=%RI32 fVirtualWarpDrive=%RTbool\n",
    453455            pVM->tm.s.u32VirtualWarpDrivePercentage, pVM->tm.s.fVirtualWarpDrive));
    454456
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