VirtualBox

Changeset 32748 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Sep 24, 2010 9:28:02 AM (14 years ago)
Author:
vboxsync
Message:

r0drv/linux/timer-r0drv-linux.c: fixes for cpu specific timers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c

    r32737 r32748  
    228228    ASMOutStrU8(0x504, (uint8_t *)&szTmp[0], cb);
    229229}
    230 #define RTAssertMsg1Weak(pszExpr, uLine, pszFile, pszFunction) \
     230# define RTAssertMsg1Weak(pszExpr, uLine, pszFile, pszFunction) \
    231231    myLogBackdoorPrintf("\n!!Guest Assertion failed!!\n%s(%d) %s\n%s\n", uLine, pszFile, pszFunction, (pszExpr))
    232 #define RTAssertMsg2Weak myLogBackdoorPrintf
    233 #define dprintf(a)          myLogBackdoorPrintf a
     232# define RTAssertMsg2Weak myLogBackdoorPrintf
     233# define RTTIMERLNX_LOG(a)          myLogBackdoorPrintf a
    234234#else
    235 #define dprintf(a)          do { } while (0)
     235# define RTTIMERLNX_LOG(a)          do { } while (0)
    236236#endif
    237237
     
    242242{
    243243#ifdef DEBUG_HACKING
    244     dprintf(("set %d -> %d\n", *penmState, enmNewState));
     244    RTTIMERLNX_LOG(("set %d -> %d\n", *penmState, enmNewState));
    245245#endif
    246246    ASMAtomicWriteU32((uint32_t volatile *)penmState, enmNewState);
     
    261261    RTTIMERLNXSTATE enmOldState = enmCurState;
    262262    bool fRc = ASMAtomicCmpXchgExU32((uint32_t volatile *)penmState, enmNewState, enmCurState, (uint32_t *)&enmOldState);
    263     dprintf(("cxg %d -> %d - %d at %u\n", enmOldState, enmNewState, fRc, uLine));
     263    RTTIMERLNX_LOG(("cxg %d -> %d - %d at %u\n", enmOldState, enmNewState, fRc, uLine));
    264264    return fRc;
    265265}
     
    351351    if (fHighRes)
    352352        pSubTimer->u.Std.u64NextTS = u64NextTS;
    353     dprintf(("startsubtimer %p\n", pSubTimer->pParent));
     353    RTTIMERLNX_LOG(("startsubtimer %p\n", pSubTimer->pParent));
    354354
    355355    pSubTimer->iTick = 0;
     
    390390static void rtTimerLnxStopSubTimer(PRTTIMERLNXSUBTIMER pSubTimer, bool fHighRes)
    391391{
    392     dprintf(("stopsubtimer %p %d\n", pSubTimer->pParent, fHighRes));
     392    RTTIMERLNX_LOG(("stopsubtimer %p %d\n", pSubTimer->pParent, fHighRes));
    393393#ifdef RTTIMER_LINUX_WITH_HRTIMER
    394394    if (fHighRes)
     
    414414    RTSPINLOCK hSpinlock = pTimer->hSpinlock;
    415415    Assert(pTimer->fSuspended);
    416     dprintf(("destroyit %p\n", pTimer));
     416    RTTIMERLNX_LOG(("destroyit %p\n", pTimer));
    417417
    418418    /*
     
    454454    if (pTimer->cCpus > 1)
    455455    {
    456         bool            fAllStopped = true;
    457456        uint32_t        iCpu        = pTimer->cCpus;
    458457        RTSPINLOCKTMP   Tmp         = RTSPINLOCKTMP_INITIALIZER;
     
    591590
    592591
    593     dprintf(("hrcallback %p\n", pTimer));
     592    RTTIMERLNX_LOG(("hrcallback %p\n", pTimer));
    594593    if (RT_UNLIKELY(!rtTimerLnxChangeToCallbackState(pSubTimer)))
    595594        return HRTIMER_NORESTART;
     
    599598     * Check for unwanted migration.
    600599     */
    601     if (   (pTimer->fSpecificCpu || pTimer->fAllCpus)
    602         && RT_UNLIKELY((RTCPUID)(pSubTimer - &pTimer->aSubTimers[0]) != RTMpCpuId()))
    603     {
    604         rtTimerLnxCallbackHandleMigration(pTimer, pSubTimer);
    605         return HRTIMER_NORESTART;
     600    if (pTimer->fAllCpus || pTimer->fSpecificCpu)
     601    {
     602        RTCPUID idCpu = RTMpCpuId();
     603        if (RT_UNLIKELY(  pTimer->fAllCpus
     604                        ? (RTCPUID)(pSubTimer - &pTimer->aSubTimers[0]) != idCpu
     605                        : pTimer->idCpu != idCpu))
     606        {
     607            rtTimerLnxCallbackHandleMigration(pTimer, pSubTimer);
     608            return HRTIMER_NORESTART;
     609        }
    606610    }
    607611#endif
     
    678682    PRTTIMER            pTimer    = pSubTimer->pParent;
    679683
    680     dprintf(("hrcallback %p\n", pTimer));
     684    RTTIMERLNX_LOG(("stdcallback %p\n", pTimer));
    681685    if (RT_UNLIKELY(!rtTimerLnxChangeToCallbackState(pSubTimer)))
    682686        return;
     
    686690     * Check for unwanted migration.
    687691     */
    688     if (   (pTimer->fSpecificCpu || pTimer->fAllCpus)
    689         && RT_UNLIKELY((RTCPUID)(pSubTimer - &pTimer->aSubTimers[0]) != RTMpCpuId()))
    690     {
    691         rtTimerLnxCallbackHandleMigration(pTimer, pSubTimer);
    692         return;
    693     }
     692    if (pTimer->fAllCpus || pTimer->fSpecificCpu)
     693    {
     694        RTCPUID idCpu = RTMpCpuId();
     695        if (RT_UNLIKELY(  pTimer->fAllCpus
     696                        ? (RTCPUID)(pSubTimer - &pTimer->aSubTimers[0]) != idCpu
     697                        : pTimer->idCpu != idCpu))
     698        {
     699            rtTimerLnxCallbackHandleMigration(pTimer, pSubTimer);
     700            return;
     701        }
     702    }
     703
    694704#endif
    695705
     
    910920             * them because of the STARTING state. This is an extremely unlikely case - not that
    911921             * that means anything in my experience... ;-) */
     922            RTTIMERLNX_LOG(("what!? iCpu=%u -> didn't start\n", iCpu));
    912923        }
    913924
     
    11521163    if (!ASMAtomicUoReadBool(&pTimer->fSuspended))
    11531164        return VERR_TIMER_ACTIVE;
    1154     dprintf(("start %p\n", pTimer));
     1165    RTTIMERLNX_LOG(("start %p cCpus=%d\n", pTimer, pTimer->cCpus));
    11551166
    11561167    Args.u64First = u64First;
     
    12231234static bool rtTimerLnxStop(PRTTIMER pTimer, bool fForDestroy)
    12241235{
    1225     dprintf(("lnxstop %p %d\n", pTimer, fForDestroy));
     1236    RTTIMERLNX_LOG(("lnxstop %p %d\n", pTimer, fForDestroy));
    12261237#ifdef CONFIG_SMP
    12271238    /*
     
    12881299    AssertPtrReturn(pTimer, VERR_INVALID_HANDLE);
    12891300    AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);
    1290     dprintf(("stop %p\n", pTimer));
     1301    RTTIMERLNX_LOG(("stop %p\n", pTimer));
    12911302
    12921303    if (ASMAtomicUoReadBool(&pTimer->fSuspended))
     
    13101321    AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);
    13111322    AssertReturn(u64NanoInterval, VERR_INVALID_PARAMETER);
    1312     dprintf(("change %p %llu\n", pTimer, u64NanoInterval));
     1323    RTTIMERLNX_LOG(("change %p %llu\n", pTimer, u64NanoInterval));
    13131324
    13141325#ifdef RTTIMER_LINUX_WITH_HRTIMER
     
    13561367    AssertPtrReturn(pTimer, VERR_INVALID_HANDLE);
    13571368    AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);
    1358     dprintf(("destroy %p\n", pTimer));
     1369    RTTIMERLNX_LOG(("destroy %p\n", pTimer));
    13591370
    13601371    /*
     
    15161527#endif /* CONFIG_SMP */
    15171528
    1518     dprintf(("create %p\n", pTimer));
     1529    RTTIMERLNX_LOG(("create %p hires=%d fFlags=%#x cCpus=%u\n", pTimer, pTimer->fHighRes, fFlags, cCpus));
    15191530    *ppTimer = pTimer;
    15201531    return VINF_SUCCESS;
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