VirtualBox

Changeset 20784 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Jun 22, 2009 2:37:39 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
48904
Message:

TM: Renamed the EmtLock to TimerCritSect as it's almost only used for timer list serialization and we want to let other threads do that too.

File:
1 edited

Legend:

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

    r20778 r20784  
    6666
    6767
    68 #ifndef tmLock
    69 
    70 /**
    71  * Try take the EMT/TM lock, wait in ring-3 return VERR_SEM_BUSY in R0/RC.
     68#ifndef tmTimerLock
     69
     70/**
     71 * Try take the timer lock, wait in ring-3 return VERR_SEM_BUSY in R0/RC.
    7272 *
    7373 * @retval  VINF_SUCCESS on success (always in ring-3).
     
    7575 *
    7676 * @param   pVM         The VM handle.
    77  */
    78 int tmLock(PVM pVM)
     77 *
     78 * @thread  EMTs for the time being.
     79 */
     80int tmTimerLock(PVM pVM)
    7981{
    8082    VM_ASSERT_EMT(pVM);
    81     int rc = PDMCritSectEnter(&pVM->tm.s.EmtLock, VERR_SEM_BUSY);
     83    int rc = PDMCritSectEnter(&pVM->tm.s.TimerCritSect, VERR_SEM_BUSY);
    8284    return rc;
    8385}
     
    8587
    8688/**
    87  * Try take the EMT/TM lock, no waiting.
     89 * Try take the timer lock, no waiting.
    8890 *
    8991 * @retval  VINF_SUCCESS on success.
     
    9294 * @param   pVM         The VM handle.
    9395 */
    94 int tmTryLock(PVM pVM)
    95 {
    96     VM_ASSERT_EMT(pVM);
    97     int rc = PDMCritSectTryEnter(&pVM->tm.s.EmtLock);
     96int tmTimerTryLock(PVM pVM)
     97{
     98    int rc = PDMCritSectTryEnter(&pVM->tm.s.TimerCritSect);
    9899    return rc;
    99100}
     
    105106 * @param   pVM         The VM handle.
    106107 */
    107 void tmUnlock(PVM pVM)
    108 {
    109     PDMCritSectLeave(&pVM->tm.s.EmtLock);
     108void tmTimerUnlock(PVM pVM)
     109{
     110    PDMCritSectLeave(&pVM->tm.s.TimerCritSect);
    110111}
    111112
     
    261262    PVM pVM = pTimer->CTX_SUFF(pVM);
    262263    if (    VM_IS_EMT(pVM)
    263         &&  RT_SUCCESS(tmTryLock(pVM)))
     264        &&  RT_SUCCESS(tmTimerTryLock(pVM)))
    264265    {
    265266        STAM_PROFILE_START(&pVM->tm.s.CTX_SUFF_Z(StatScheduleOne), a);
     
    270271#endif
    271272        STAM_PROFILE_STOP(&pVM->tm.s.CTX_SUFF_Z(StatScheduleOne), a);
    272         tmUnlock(pVM);
     273        tmTimerUnlock(pVM);
    273274    }
    274275    else
     
    817818
    818819    STAM_COUNTER_INC(&pVM->tm.s.StatTimerSetOpt);
    819     tmUnlock(pVM);
     820    tmTimerUnlock(pVM);
    820821    return VINF_SUCCESS;
    821822}
     
    866867    {
    867868        /* Try take the TM lock and check the state again. */
    868         if (RT_SUCCESS_NP(tmTryLock(pVM)))
     869        if (RT_SUCCESS_NP(tmTimerTryLock(pVM)))
    869870        {
    870871            if (RT_LIKELY(tmTimerTry(pTimer, TMTIMERSTATE_ACTIVE, enmState)))
     
    874875                return VINF_SUCCESS;
    875876            }
    876             tmUnlock(pVM);
     877            tmTimerUnlock(pVM);
    877878        }
    878879    }
     
    10411042
    10421043    STAM_COUNTER_INC(&pVM->tm.s.StatTimerSetRelativeOpt);
    1043     tmUnlock(pVM);
     1044    tmTimerUnlock(pVM);
    10441045    return VINF_SUCCESS;
    10451046}
     
    10921093     *       get the innermost locks.
    10931094     */
    1094     bool fOwnTMLock = RT_SUCCESS_NP(tmTryLock(pVM));
     1095    bool fOwnTMLock = RT_SUCCESS_NP(tmTimerTryLock(pVM));
    10951096#if 1
    10961097    if (    fOwnTMLock
     
    12481249        if (!fOwnTMLock)
    12491250        {
    1250             fOwnTMLock = RT_SUCCESS_NP(tmTryLock(pVM));
     1251            fOwnTMLock = RT_SUCCESS_NP(tmTimerTryLock(pVM));
    12511252            if (    !fOwnTMLock
    12521253                &&  enmClock == TMCLOCK_VIRTUAL_SYNC
     
    12631264        tmVirtualSyncUnlock(pVM);
    12641265    if (fOwnTMLock)
    1265         tmUnlock(pVM);
     1266        tmTimerUnlock(pVM);
    12661267
    12671268    if (    !fOwnTMLock
     
    20352036void tmTimerQueueSchedule(PVM pVM, PTMTIMERQUEUE pQueue)
    20362037{
    2037     TM_ASSERT_EMT_LOCK(pVM);
     2038    TM_ASSERT_LOCK(pVM);
    20382039
    20392040    /*
     
    20762077void tmTimerQueuesSanityChecks(PVM pVM, const char *pszWhere)
    20772078{
    2078     TM_ASSERT_EMT_LOCK(pVM);
     2079    TM_ASSERT_LOCK(pVM);
    20792080
    20802081    /*
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