VirtualBox

Changeset 87814 in vbox


Ignore:
Timestamp:
Feb 19, 2021 10:03:56 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142875
Message:

VMM/TM: Eliminated the enmClock member from TMTIMER, we'll be using TMTIMERQUEUE::enmClock instead since the queue is always handy. bugref:9943

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/TMAll.cpp

    r87813 r87814  
    358358 * Schedule the queue which was changed.
    359359 */
    360 DECLINLINE(void) tmSchedule(PVMCC pVM, PTMTIMER pTimer)
    361 {
    362     TMCLOCK const           enmClock = pTimer->enmClock;
    363     AssertReturnVoid((unsigned)enmClock < TMCLOCK_MAX);
    364     PTMTIMERQUEUE const     pQueue   = &pVM->tm.s.aTimerQueues[enmClock];
    365     PTMTIMERQUEUECC const   pQueueCC = TM_GET_TIMER_QUEUE_CC(pVM, enmClock, pQueue);
    366 
     360DECLINLINE(void) tmSchedule(PVMCC pVM, PTMTIMERQUEUECC pQueueCC, PTMTIMERQUEUE pQueue, PTMTIMER pTimer)
     361{
    367362    if (VM_IS_EMT(pVM)) /** @todo drop EMT requirement here. */
    368363    {
     
    440435 *
    441436 * @returns Success indicator.
    442  * @param   pVM             The cross context VM structure.
    443  * @param   pTimer          Timer in question.
    444  * @param   enmStateNew     The new timer state.
    445  * @param   enmStateOld     The old timer state.
    446  */
    447 DECLINLINE(bool) tmTimerTryWithLink(PVMCC pVM, PTMTIMER pTimer, TMTIMERSTATE enmStateNew, TMTIMERSTATE enmStateOld)
    448 {
    449     TMCLOCK const enmClock = pTimer->enmClock;
    450     AssertReturn((unsigned)enmClock < TMCLOCK_MAX, false);
     437 * @param   pQueueCC    The current context queue (same as @a pQueue for
     438 *                      ring-3).
     439 * @param   pQueue      The shared queue data.
     440 * @param   pTimer      Timer in question.
     441 * @param   enmStateNew The new timer state.
     442 * @param   enmStateOld The old timer state.
     443 */
     444DECLINLINE(bool) tmTimerTryWithLink(PTMTIMERQUEUECC pQueueCC, PTMTIMERQUEUE pQueue, PTMTIMER pTimer,
     445                                    TMTIMERSTATE enmStateNew, TMTIMERSTATE enmStateOld)
     446{
    451447    if (tmTimerTry(pTimer, enmStateNew, enmStateOld))
    452448    {
    453         PTMTIMERQUEUE const pQueue = &pVM->tm.s.aTimerQueues[enmClock];
    454         tmTimerLinkSchedule(TM_GET_TIMER_QUEUE_CC(pVM, enmClock, pQueue), pQueue, pTimer);
     449        tmTimerLinkSchedule(pQueueCC, pQueue, pTimer);
    455450        return true;
    456451    }
     
    476471    Assert(pTimer->idxNext == UINT32_MAX);
    477472    Assert(pTimer->idxPrev == UINT32_MAX);
    478     Assert(pTimer->enmState == TMTIMERSTATE_ACTIVE || pTimer->enmClock != TMCLOCK_VIRTUAL_SYNC); /* (active is not a stable state) */
     473    Assert(pTimer->enmState == TMTIMERSTATE_ACTIVE || pQueue->enmClock != TMCLOCK_VIRTUAL_SYNC); /* (active is not a stable state) */
    479474    RT_NOREF(pVM);
    480475
     
    648643         */
    649644        Log2(("tmTimerQueueSchedule: %p:{.enmState=%s, .enmClock=%d, .enmType=%d, .szName=%s}\n",
    650               pTimer, tmTimerState(pTimer->enmState), pTimer->enmClock, pTimer->enmType, pTimer->szName));
     645              pTimer, tmTimerState(pTimer->enmState), pQueue->enmClock, pTimer->enmType, pTimer->szName));
    651646        tmTimerQueueScheduleOne(pVM, pQueueCC, pQueue, pTimer);
    652647        Log2(("tmTimerQueueSchedule: %p: new %s\n", pTimer, tmTimerState(pTimer->enmState)));
     
    683678                     pPrev = pCur, pCur = tmTimerGetNext(pQueueCC, pCur))
    684679                {
    685                     AssertMsg(pCur->enmClock == (TMCLOCK)idxQueue, ("%s: %d != %u\n", pszWhere, pCur->enmClock, idxQueue));
    686680                    AssertMsg(tmTimerGetPrev(pQueueCC, pCur) == pPrev, ("%s: %p != %p\n", pszWhere, tmTimerGetPrev(pQueueCC, pCur), pPrev));
    687681                    TMTIMERSTATE enmState = pCur->enmState;
     
    13771371            case TMTIMERSTATE_EXPIRED_DELIVER:
    13781372            case TMTIMERSTATE_STOPPED:
    1379                 if (tmTimerTryWithLink(pVM, pTimer, TMTIMERSTATE_PENDING_SCHEDULE_SET_EXPIRE, enmState))
     1373                if (tmTimerTryWithLink(pQueueCC, pQueue, pTimer, TMTIMERSTATE_PENDING_SCHEDULE_SET_EXPIRE, enmState))
    13801374                {
    13811375                    Assert(pTimer->idxPrev == UINT32_MAX);
     
    13831377                    pTimer->u64Expire = u64Expire;
    13841378                    TM_SET_STATE(pTimer, TMTIMERSTATE_PENDING_SCHEDULE);
    1385                     tmSchedule(pVM, pTimer);
     1379                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    13861380                    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSet), a);
    13871381                    return VINF_SUCCESS;
     
    13951389                    pTimer->u64Expire = u64Expire;
    13961390                    TM_SET_STATE(pTimer, TMTIMERSTATE_PENDING_SCHEDULE);
    1397                     tmSchedule(pVM, pTimer);
     1391                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    13981392                    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSet), a);
    13991393                    return VINF_SUCCESS;
     
    14031397
    14041398            case TMTIMERSTATE_ACTIVE:
    1405                 if (tmTimerTryWithLink(pVM, pTimer, TMTIMERSTATE_PENDING_RESCHEDULE_SET_EXPIRE, enmState))
     1399                if (tmTimerTryWithLink(pQueueCC, pQueue, pTimer, TMTIMERSTATE_PENDING_RESCHEDULE_SET_EXPIRE, enmState))
    14061400                {
    14071401                    pTimer->u64Expire = u64Expire;
    14081402                    TM_SET_STATE(pTimer, TMTIMERSTATE_PENDING_RESCHEDULE);
    1409                     tmSchedule(pVM, pTimer);
     1403                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    14101404                    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSet), a);
    14111405                    return VINF_SUCCESS;
     
    14191413                    pTimer->u64Expire = u64Expire;
    14201414                    TM_SET_STATE(pTimer, TMTIMERSTATE_PENDING_RESCHEDULE);
    1421                     tmSchedule(pVM, pTimer);
     1415                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    14221416                    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSet), a);
    14231417                    return VINF_SUCCESS;
     
    14981492 * @param   pu64Now         Where to return the current time stamp used.
    14991493 *                          Optional.
    1500  * @param   pQueue          Pointer to the shared timer queue data.
    1501  * @param   idxQueue        The queue index.
     1494 * @param   pQueueCC        The context specific queue data (same as @a pQueue
     1495 *                          for ring-3).
     1496 * @param   pQueue          The shared queue data.
    15021497 */
    15031498static int tmTimerSetRelativeOptimizedStart(PVMCC pVM, PTMTIMER pTimer, uint64_t cTicksToNext, uint64_t *pu64Now,
    1504                                             PTMTIMERQUEUE pQueue, uint32_t idxQueue)
     1499                                            PTMTIMERQUEUECC pQueueCC, PTMTIMERQUEUE pQueue)
    15051500{
    15061501    Assert(pTimer->idxPrev == UINT32_MAX);
     
    15191514     */
    15201515    DBGFTRACE_U64_TAG2(pVM, u64Expire, "tmTimerSetRelativeOptimizedStart", pTimer->szName);
    1521     tmTimerQueueLinkActive(pVM, TM_GET_TIMER_QUEUE_CC(pVM, idxQueue, pQueue), pQueue, pTimer, u64Expire);
     1516    tmTimerQueueLinkActive(pVM, pQueueCC, pQueue, pTimer, u64Expire);
    15221517
    15231518    STAM_COUNTER_INC(&pVM->tm.s.StatTimerSetRelativeOpt);
    1524     RT_NOREF(idxQueue);
    15251519    return VINF_SUCCESS;
    15261520}
     
    16141608 * @param   pu64Now         Where to return the current time stamp used.
    16151609 *                          Optional.
     1610 * @param   pQueueCC        The context specific queue data (same as @a pQueue
     1611 *                          for ring-3).
     1612 * @param   pQueue          The shared queue data.
     1613 * @param   idxQueue        The queue index.
    16161614 */
    16171615static int tmTimerSetRelative(PVMCC pVM, PTMTIMER pTimer, uint64_t cTicksToNext, uint64_t *pu64Now,
    1618                               PTMTIMERQUEUE pQueue, uint32_t idxQueue)
     1616                              PTMTIMERQUEUECC pQueueCC, PTMTIMERQUEUE pQueue)
    16191617{
    16201618    STAM_COUNTER_INC(&pTimer->StatSetRelative);
    16211619
    16221620    /* Treat virtual sync timers specially. */
    1623     if (idxQueue == TMCLOCK_VIRTUAL_SYNC)
     1621    if (pQueue->enmClock == TMCLOCK_VIRTUAL_SYNC)
    16241622        return tmTimerVirtualSyncSetRelative(pVM, pTimer, cTicksToNext, pu64Now);
    16251623
     
    16711669                      && tmTimerTry(pTimer, TMTIMERSTATE_ACTIVE, enmState)))
    16721670        {
    1673             tmTimerSetRelativeOptimizedStart(pVM, pTimer, cTicksToNext, pu64Now, pQueue, idxQueue);
     1671            tmTimerSetRelativeOptimizedStart(pVM, pTimer, cTicksToNext, pu64Now, pQueueCC, pQueue);
    16741672            STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerSetRelative), a);
    16751673            PDMCritSectLeave(&pQueue->TimerLock);
     
    17041702                RT_FALL_THRU();
    17051703            case TMTIMERSTATE_EXPIRED_DELIVER:
    1706                 if (tmTimerTryWithLink(pVM, pTimer, TMTIMERSTATE_PENDING_SCHEDULE_SET_EXPIRE, enmState))
     1704                if (tmTimerTryWithLink(pQueueCC, pQueue, pTimer, TMTIMERSTATE_PENDING_SCHEDULE_SET_EXPIRE, enmState))
    17071705                {
    17081706                    Assert(pTimer->idxPrev == UINT32_MAX);
     
    17121710                          pTimer, tmTimerState(enmState), pTimer->szName, pTimer->u64Expire, cRetries));
    17131711                    TM_SET_STATE(pTimer, TMTIMERSTATE_PENDING_SCHEDULE);
    1714                     tmSchedule(pVM, pTimer);
     1712                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    17151713                    rc = VINF_SUCCESS;
    17161714                    break;
     
    17271725                          pTimer, tmTimerState(enmState), pTimer->szName, pTimer->u64Expire, cRetries));
    17281726                    TM_SET_STATE(pTimer, TMTIMERSTATE_PENDING_SCHEDULE);
    1729                     tmSchedule(pVM, pTimer);
     1727                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    17301728                    rc = VINF_SUCCESS;
    17311729                    break;
     
    17361734
    17371735            case TMTIMERSTATE_ACTIVE:
    1738                 if (tmTimerTryWithLink(pVM, pTimer, TMTIMERSTATE_PENDING_RESCHEDULE_SET_EXPIRE, enmState))
     1736                if (tmTimerTryWithLink(pQueueCC, pQueue, pTimer, TMTIMERSTATE_PENDING_RESCHEDULE_SET_EXPIRE, enmState))
    17391737                {
    17401738                    pTimer->u64Expire = cTicksToNext + tmTimerSetRelativeNowWorker(pVM, pQueue->enmClock, pu64Now);
     
    17421740                          pTimer, tmTimerState(enmState), pTimer->szName, pTimer->u64Expire, cRetries));
    17431741                    TM_SET_STATE(pTimer, TMTIMERSTATE_PENDING_RESCHEDULE);
    1744                     tmSchedule(pVM, pTimer);
     1742                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    17451743                    rc = VINF_SUCCESS;
    17461744                    break;
     
    17571755                          pTimer, tmTimerState(enmState), pTimer->szName, pTimer->u64Expire, cRetries));
    17581756                    TM_SET_STATE(pTimer, TMTIMERSTATE_PENDING_RESCHEDULE);
    1759                     tmSchedule(pVM, pTimer);
     1757                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    17601758                    rc = VINF_SUCCESS;
    17611759                    break;
     
    18411839{
    18421840    TMTIMER_HANDLE_TO_VARS_RETURN(pVM, hTimer); /* => pTimer, pQueueCC, pQueue, idxTimer, idxQueue */
    1843     return tmTimerSetRelative(pVM, pTimer, cTicksToNext, pu64Now, pQueue, idxQueue);
     1841    return tmTimerSetRelative(pVM, pTimer, cTicksToNext, pu64Now, pQueueCC, pQueue);
    18441842}
    18451843
     
    20072005                if (tmTimerTry(pTimer, TMTIMERSTATE_PENDING_STOP_SCHEDULE, enmState))
    20082006                {
    2009                     tmSchedule(pVM, pTimer);
     2007                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    20102008                    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerStop), a);
    20112009                    return VINF_SUCCESS;
     
    20162014                if (tmTimerTry(pTimer, TMTIMERSTATE_PENDING_STOP, enmState))
    20172015                {
    2018                     tmSchedule(pVM, pTimer);
     2016                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    20192017                    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerStop), a);
    20202018                    return VINF_SUCCESS;
     
    20232021
    20242022            case TMTIMERSTATE_ACTIVE:
    2025                 if (tmTimerTryWithLink(pVM, pTimer, TMTIMERSTATE_PENDING_STOP, enmState))
     2023                if (tmTimerTryWithLink(pQueueCC, pQueue, pTimer, TMTIMERSTATE_PENDING_STOP, enmState))
    20262024                {
    2027                     tmSchedule(pVM, pTimer);
     2025                    tmSchedule(pVM, pQueueCC, pQueue, pTimer);
    20282026                    STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatTimerStop), a);
    20292027                    return VINF_SUCCESS;
     
    22522250        case TMCLOCK_VIRTUAL:
    22532251            AssertCompile(TMCLOCK_FREQ_VIRTUAL == 1000000000);
    2254             return tmTimerSetRelative(pVM, pTimer, cMilliesToNext * UINT64_C(1000000), NULL, pQueue, idxQueue);
     2252            return tmTimerSetRelative(pVM, pTimer, cMilliesToNext * UINT64_C(1000000), NULL, pQueueCC, pQueue);
    22552253
    22562254        case TMCLOCK_VIRTUAL_SYNC:
    22572255            AssertCompile(TMCLOCK_FREQ_VIRTUAL == 1000000000);
    2258             return tmTimerSetRelative(pVM, pTimer, cMilliesToNext * UINT64_C(1000000), NULL, pQueue, idxQueue);
     2256            return tmTimerSetRelative(pVM, pTimer, cMilliesToNext * UINT64_C(1000000), NULL, pQueueCC, pQueue);
    22592257
    22602258        case TMCLOCK_REAL:
    22612259            AssertCompile(TMCLOCK_FREQ_REAL == 1000);
    2262             return tmTimerSetRelative(pVM, pTimer, cMilliesToNext, NULL, pQueue, idxQueue);
     2260            return tmTimerSetRelative(pVM, pTimer, cMilliesToNext, NULL, pQueueCC, pQueue);
    22632261
    22642262        default:
     
    22842282        case TMCLOCK_VIRTUAL:
    22852283            AssertCompile(TMCLOCK_FREQ_VIRTUAL == 1000000000);
    2286             return tmTimerSetRelative(pVM, pTimer, cMicrosToNext * 1000, NULL, pQueue, idxQueue);
     2284            return tmTimerSetRelative(pVM, pTimer, cMicrosToNext * 1000, NULL, pQueueCC, pQueue);
    22872285
    22882286        case TMCLOCK_VIRTUAL_SYNC:
    22892287            AssertCompile(TMCLOCK_FREQ_VIRTUAL == 1000000000);
    2290             return tmTimerSetRelative(pVM, pTimer, cMicrosToNext * 1000, NULL, pQueue, idxQueue);
     2288            return tmTimerSetRelative(pVM, pTimer, cMicrosToNext * 1000, NULL, pQueueCC, pQueue);
    22912289
    22922290        case TMCLOCK_REAL:
    22932291            AssertCompile(TMCLOCK_FREQ_REAL == 1000);
    2294             return tmTimerSetRelative(pVM, pTimer, cMicrosToNext / 1000, NULL, pQueue, idxQueue);
     2292            return tmTimerSetRelative(pVM, pTimer, cMicrosToNext / 1000, NULL, pQueueCC, pQueue);
    22952293
    22962294        default:
     
    23122310{
    23132311    TMTIMER_HANDLE_TO_VARS_RETURN(pVM, hTimer); /* => pTimer, pQueueCC, pQueue, idxTimer, idxQueue */
    2314     switch (pTimer->enmClock)
     2312    switch (pQueue->enmClock)
    23152313    {
    23162314        case TMCLOCK_VIRTUAL:
    23172315            AssertCompile(TMCLOCK_FREQ_VIRTUAL == 1000000000);
    2318             return tmTimerSetRelative(pVM, pTimer, cNanosToNext, NULL, pQueue, idxQueue);
     2316            return tmTimerSetRelative(pVM, pTimer, cNanosToNext, NULL, pQueueCC, pQueue);
    23192317
    23202318        case TMCLOCK_VIRTUAL_SYNC:
    23212319            AssertCompile(TMCLOCK_FREQ_VIRTUAL == 1000000000);
    2322             return tmTimerSetRelative(pVM, pTimer, cNanosToNext, NULL, pQueue, idxQueue);
     2320            return tmTimerSetRelative(pVM, pTimer, cNanosToNext, NULL, pQueueCC, pQueue);
    23232321
    23242322        case TMCLOCK_REAL:
    23252323            AssertCompile(TMCLOCK_FREQ_REAL == 1000);
    2326             return tmTimerSetRelative(pVM, pTimer, cNanosToNext / 1000000, NULL, pQueue, idxQueue);
     2324            return tmTimerSetRelative(pVM, pTimer, cNanosToNext / 1000000, NULL, pQueueCC, pQueue);
    23272325
    23282326        default:
    2329             AssertMsgFailed(("Invalid enmClock=%d\n", pTimer->enmClock));
     2327            AssertMsgFailed(("Invalid enmClock=%d\n", pQueue->enmClock));
    23302328            return VERR_TM_TIMER_BAD_CLOCK;
    23312329    }
  • trunk/src/VBox/VMM/VMMR0/TMR0.cpp

    r87796 r87814  
    139139            {
    140140                paTimers[i].u64Expire       = UINT64_MAX;
    141                 paTimers[i].enmClock        = TMCLOCK_MAX;
    142141                paTimers[i].enmType         = TMTIMERTYPE_INVALID;
    143142                paTimers[i].enmState        = TMTIMERSTATE_FREE;
  • trunk/src/VBox/VMM/VMMR3/TM.cpp

    r87813 r87814  
    15151515
    15161516#ifdef VBOX_WITH_STATISTICS
    1517 /** Names the clock of the timer.   */
    1518 static const char *tmR3TimerClockName(PTMTIMERR3 pTimer)
    1519 {
    1520     switch (pTimer->enmClock)
    1521     {
    1522         case TMCLOCK_VIRTUAL:       return "virtual";
    1523         case TMCLOCK_VIRTUAL_SYNC:  return "virtual-sync";
    1524         case TMCLOCK_REAL:          return "real";
    1525         case TMCLOCK_TSC:           return "tsc";
    1526         case TMCLOCK_MAX:           break;
    1527     }
    1528     return "corrupt clock value";
    1529 }
    1530 #endif
    1531 
    1532 
    1533 #ifdef VBOX_WITH_STATISTICS
    15341517
    15351518/**
     
    15371520 *
    15381521 * @param   pVM         The cross context VM structure.
     1522 * @param   pQueue      The queue the timer belongs to.
    15391523 * @param   pTimer      The timer to register statistics for.
    15401524 */
    1541 static void tmR3TimerRegisterStats(PVM pVM, PTMTIMER pTimer)
     1525static void tmR3TimerRegisterStats(PVM pVM, PTMTIMERQUEUE pQueue, PTMTIMER pTimer)
    15421526{
    15431527    STAMR3RegisterF(pVM, &pTimer->StatTimer,            STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL,
    1544                     tmR3TimerClockName(pTimer), "/TM/Timers/%s", pTimer->szName);
     1528                    pQueue->szName, "/TM/Timers/%s", pTimer->szName);
    15451529    STAMR3RegisterF(pVM, &pTimer->StatCritSectEnter,    STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL,
    15461530                    "",                         "/TM/Timers/%s/CritSectEnter", pTimer->szName);
     
    15841568        TMTIMERSTATE enmState = pTimer->enmState;
    15851569        if (enmState > TMTIMERSTATE_INVALID && enmState < TMTIMERSTATE_DESTROY)
    1586             tmR3TimerRegisterStats(pVM, pTimer);
     1570            tmR3TimerRegisterStats(pVM, pQueue, pTimer);
    15871571    }
    15881572}
     
    16841668
    16851669    pTimer->u64Expire       = 0;
    1686     pTimer->enmClock        = enmClock;
    16871670    pTimer->enmState        = TMTIMERSTATE_STOPPED;
    16881671    pTimer->idxScheduleNext = UINT32_MAX;
     
    17071690     */
    17081691    if (pQueue->fCannotGrow)
    1709         tmR3TimerRegisterStats(pVM, pTimer);
     1692        tmR3TimerRegisterStats(pVM, pQueue, pTimer);
    17101693#endif
    17111694
     
    24362419        }
    24372420        Log2(("tmR3TimerQueueRun: %p:{.enmState=%s, .enmClock=%d, .enmType=%d, u64Expire=%llx (now=%llx) .szName='%s'}\n",
    2438               pTimer, tmTimerState(pTimer->enmState), pTimer->enmClock, pTimer->enmType, pTimer->u64Expire, u64Now, pTimer->szName));
     2421              pTimer, tmTimerState(pTimer->enmState), pQueue->enmClock, pTimer->enmType, pTimer->u64Expire, u64Now, pTimer->szName));
    24392422        bool fRc;
    24402423        TM_TRY_SET_STATE(pTimer, TMTIMERSTATE_EXPIRED_GET_UNLINK, TMTIMERSTATE_ACTIVE, fRc);
     
    26292612
    26302613        Log2(("tmR3TimerQueueRun: %p:{.enmState=%s, .enmClock=%d, .enmType=%d, u64Expire=%llx (now=%llx) .szName='%s'}\n",
    2631               pTimer, tmTimerState(pTimer->enmState), pTimer->enmClock, pTimer->enmType, pTimer->u64Expire, u64Now, pTimer->szName));
     2614              pTimer, tmTimerState(pTimer->enmState), pQueue->enmClock, pTimer->enmType, pTimer->u64Expire, u64Now, pTimer->szName));
    26322615
    26332616        /* Advance the clock - don't permit timers to be out of order or armed
     
    38493832    for (uint32_t idxQueue = 0; idxQueue < RT_ELEMENTS(pVM->tm.s.aTimerQueues); idxQueue++)
    38503833    {
    3851         PTMTIMERQUEUE pQueue = &pVM->tm.s.aTimerQueues[idxQueue];
     3834        PTMTIMERQUEUE const pQueue   = &pVM->tm.s.aTimerQueues[idxQueue];
     3835        const char * const  pszClock = tmR3Get5CharClockName(pQueue->enmClock);
    38523836        PDMCritSectRwEnterShared(&pQueue->AllocLock, VERR_IGNORED);
    38533837        for (uint32_t idxTimer = 0; idxTimer < pQueue->cTimersAlloc; idxTimer++)
     
    38623846                                pTimer->idxPrev,
    38633847                                pTimer->idxScheduleNext,
    3864                                 tmR3Get5CharClockName(pTimer->enmClock),
     3848                                pszClock,
    38653849                                TMTimerGet(pVM, pTimer->hSelf),
    38663850                                pTimer->u64Expire,
     
    38983882    for (uint32_t idxQueue = 0; idxQueue < RT_ELEMENTS(pVM->tm.s.aTimerQueues); idxQueue++)
    38993883    {
    3900         PTMTIMERQUEUE pQueue = &pVM->tm.s.aTimerQueues[idxQueue];
     3884        PTMTIMERQUEUE const pQueue   = &pVM->tm.s.aTimerQueues[idxQueue];
     3885        const char * const  pszClock = tmR3Get5CharClockName(pQueue->enmClock);
    39013886        PDMCritSectRwEnterShared(&pQueue->AllocLock, VERR_IGNORED);
    39023887        PDMCritSectEnter(&pQueue->TimerLock, VERR_IGNORED);
     
    39123897                            pTimer->idxPrev,
    39133898                            pTimer->idxScheduleNext,
    3914                             tmR3Get5CharClockName(pTimer->enmClock),
     3899                            pszClock,
    39153900                            TMTimerGet(pVM, pTimer->hSelf),
    39163901                            pTimer->u64Expire,
  • trunk/src/VBox/VMM/include/TMInline.h

    r87813 r87814  
    141141#ifdef VBOX_STRICT
    142142    TMTIMERSTATE const enmState = pTimer->enmState;
    143     Assert(  pTimer->enmClock == TMCLOCK_VIRTUAL_SYNC
     143    Assert(  pQueue->enmClock == TMCLOCK_VIRTUAL_SYNC
    144144           ? enmState == TMTIMERSTATE_ACTIVE
    145145           : enmState == TMTIMERSTATE_PENDING_SCHEDULE || enmState == TMTIMERSTATE_PENDING_STOP_SCHEDULE);
  • trunk/src/VBox/VMM/include/TMInternal.h

    r87813 r87814  
    136136    /** Expire time. */
    137137    volatile uint64_t       u64Expire;
    138     /** Clock to apply to u64Expire. */
    139     TMCLOCK                 enmClock;
     138
     139    /** Timer state. */
     140    volatile TMTIMERSTATE   enmState;
     141    /** The index of the next next timer in the schedule list. */
     142    uint32_t volatile       idxScheduleNext;
     143
     144    /** The index of the next timer in the chain. */
     145    uint32_t                idxNext;
     146    /** The index of the previous timer in the chain. */
     147    uint32_t                idxPrev;
     148
     149    /** The timer frequency hint.  This is 0 if not hint was given. */
     150    uint32_t volatile       uHzHint;
    140151    /** Timer callback type. */
    141152    TMTIMERTYPE             enmType;
     153
     154    /** It's own handle value. */
     155    TMTIMERHANDLE           hSelf;
     156    /** TMTIMER_FLAGS_XXX.   */
     157    uint32_t                fFlags;
     158    /** Explicit alignment padding. */
     159    uint32_t                u32Alignment;
     160
     161    /** User argument. */
     162    RTR3PTR                 pvUser;
     163    /** The critical section associated with the lock. */
     164    R3PTRTYPE(PPDMCRITSECT) pCritSect;
     165
     166    /* new cache line (64-bit / 64 bytes) */
     167
    142168    /** Type specific data. */
    143169    union
     
    178204    } u;
    179205
    180     /** Timer state. */
    181     volatile TMTIMERSTATE   enmState;
    182     /** The index of the next next timer in the schedule list. */
    183     uint32_t volatile       idxScheduleNext;
    184 
    185     /** The index of the next timer in the chain. */
    186     uint32_t                idxNext;
    187     /** The index of the previous timer in the chain. */
    188     uint32_t                idxPrev;
    189 
    190     /** It's own handle value. */
    191     TMTIMERHANDLE           hSelf;
    192     /** TMTIMER_FLAGS_XXX.   */
    193     uint32_t                fFlags;
    194     /** The timer frequency hint.  This is 0 if not hint was given. */
    195     uint32_t volatile       uHzHint;
    196 
    197     /** User argument. */
    198     RTR3PTR                 pvUser;
    199     /** The critical section associated with the lock. */
    200     R3PTRTYPE(PPDMCRITSECT) pCritSect;
    201 
    202206    /** The timer name. */
    203207    char                    szName[32];
    204208
    205 #ifdef VBOX_WITH_STATISTICS
     209    /** @todo think of two useful release statistics counters here to fill up the
     210     *        cache line. */
     211#ifndef VBOX_WITH_STATISTICS
     212    uint64_t                auAlignment2[2];
     213#else
    206214    STAMPROFILE             StatTimer;
    207215    STAMPROFILE             StatCritSectEnter;
     
    210218    STAMCOUNTER             StatSetRelative;
    211219    STAMCOUNTER             StatStop;
     220    uint64_t                auAlignment2[6];
    212221#endif
    213222} TMTIMER;
     223AssertCompileMemberSize(TMTIMER, u64Expire, sizeof(uint64_t));
    214224AssertCompileMemberSize(TMTIMER, enmState, sizeof(uint32_t));
     225AssertCompileSizeAlignment(TMTIMER, 64);
    215226
    216227
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