VirtualBox

Ignore:
Timestamp:
Jun 17, 2011 10:18:02 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72361
Message:

TM: Virtual sync timer locking fixes and assertions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/TMInternal.h

    r37517 r37527  
    722722typedef TMCPU *PTMCPU;
    723723
    724 #if 0 /* enable this to rule out locking bugs on single cpu guests. */
    725 # define tmTimerLock(pVM)                VINF_SUCCESS
    726 # define tmTimerTryLock(pVM)             VINF_SUCCESS
    727 # define tmTimerUnlock(pVM)              ((void)0)
    728 # define tmVirtualSyncLock(pVM)     VINF_SUCCESS
    729 # define tmVirtualSyncTryLock(pVM)  VINF_SUCCESS
    730 # define tmVirtualSyncUnlock(pVM)   ((void)0)
    731 # define TM_ASSERT_LOCK(pVM)        VM_ASSERT_EMT(pVM)
    732 #else
    733 int                     tmTimerLock(PVM pVM);
    734 int                     tmTimerTryLock(PVM pVM);
    735 void                    tmTimerUnlock(PVM pVM);
    736 /** Checks that the caller owns the timer lock.  */
    737 #define TM_ASSERT_LOCK(pVM) Assert(PDMCritSectIsOwner(&pVM->tm.s.TimerCritSect))
    738 int                     tmVirtualSyncLock(PVM pVM);
    739 int                     tmVirtualSyncTryLock(PVM pVM);
    740 void                    tmVirtualSyncUnlock(PVM pVM);
    741 #endif
    742 
    743724const char             *tmTimerState(TMTIMERSTATE enmState);
    744725void                    tmTimerQueueSchedule(PVM pVM, PTMTIMERQUEUE pQueue);
     
    756737
    757738
     739/**
     740 * Try take the timer lock, wait in ring-3 return VERR_SEM_BUSY in R0/RC.
     741 *
     742 * @retval  VINF_SUCCESS on success (always in ring-3).
     743 * @retval  VERR_SEM_BUSY in RC and R0 if the semaphore is busy.
     744 *
     745 * @param   a_pVM       The VM handle.
     746 *
     747 * @remarks The virtual sync timer queue requires the virtual sync lock.
     748 */
     749#define TM_LOCK_TIMERS(a_pVM)       PDMCritSectEnter(&(a_pVM)->tm.s.TimerCritSect, VERR_SEM_BUSY)
     750
     751/**
     752 * Try take the timer lock, no waiting.
     753 *
     754 * @retval  VINF_SUCCESS on success.
     755 * @retval  VERR_SEM_BUSY if busy.
     756 *
     757 * @param   a_pVM       The VM handle.
     758 *
     759 * @remarks The virtual sync timer queue requires the virtual sync lock.
     760 */
     761#define TM_TRY_LOCK_TIMERS(a_pVM)   PDMCritSectTryEnter(&(a_pVM)->tm.s.TimerCritSect)
     762
     763/** Lock the timers (sans the virtual sync queue). */
     764#define TM_UNLOCK_TIMERS(a_pVM)     do { PDMCritSectLeave(&(a_pVM)->tm.s.TimerCritSect); } while (0)
     765
     766/** Checks that the caller owns the timer lock.  */
     767#define TM_ASSERT_TIMER_LOCK_OWNERSHIP(a_pVM) \
     768    Assert(PDMCritSectIsOwner(&(a_pVM)->tm.s.TimerCritSect))
     769
     770
    758771/** @} */
    759772
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