Lines Matching defs:pSubTimer
331 * @param pSubTimer The sub-timer to start.
339 static void rtTimerLnxStartSubTimer(PRTTIMERLNXSUBTIMER pSubTimer, uint64_t u64Now, uint64_t u64First,
347 pSubTimer->u.Std.u64NextTS = u64NextTS;
348 RTTIMERLNX_LOG(("startsubtimer %p\n", pSubTimer->pParent));
350 pSubTimer->iTick = 0;
354 hrtimer_start(&pSubTimer->u.Hr.LnxTimer, rtTimerLnxNanoToKt(u64NextTS),
360 pSubTimer->u.Std.ulNextJiffies = jiffies + cJiffies;
361 pSubTimer->u.Std.fFirstAfterChg = true;
364 mod_timer_pinned(&pSubTimer->u.Std.LnxTimer, pSubTimer->u.Std.ulNextJiffies);
367 mod_timer(&pSubTimer->u.Std.LnxTimer, pSubTimer->u.Std.ulNextJiffies);
371 if (!rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_ACTIVE, RTTIMERLNXSTATE_STARTING))
372 rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_ACTIVE, RTTIMERLNXSTATE_MP_STARTING);
382 * @param pSubTimer The sub-timer.
385 static void rtTimerLnxStopSubTimer(PRTTIMERLNXSUBTIMER pSubTimer, bool fHighRes)
387 RTTIMERLNX_LOG(("stopsubtimer %p %d\n", pSubTimer->pParent, fHighRes));
395 int rc = hrtimer_try_to_cancel(&pSubTimer->u.Hr.LnxTimer);
398 hrtimer_start(&pSubTimer->u.Hr.LnxTimer, ktime_set(KTIME_SEC_MAX, 0), HRTIMER_MODE_ABS);
399 hrtimer_try_to_cancel(&pSubTimer->u.Hr.LnxTimer);
404 del_timer(&pSubTimer->u.Std.LnxTimer);
406 rtTimerLnxSetState(&pSubTimer->enmState, RTTIMERLNXSTATE_STOPPED);
481 * @param pSubTimer The sub-timer which we're handling, the state of this
484 static void rtTimerLnxCallbackDestroy(PRTTIMER pTimer, PRTTIMERLNXSUBTIMER pSubTimer)
494 Assert(pSubTimer->enmState == RTTIMERLNXSTATE_CB_DESTROYING);
495 rtTimerLnxSetState(&pSubTimer->enmState, RTTIMERLNXSTATE_STOPPED);
521 * @param pSubTimer The sub-timer.
523 static void rtTimerLnxCallbackHandleMigration(PRTTIMER pTimer, PRTTIMERLNXSUBTIMER pSubTimer)
531 enmState = rtTimerLnxGetState(&pSubTimer->enmState);
548 if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_STOPPED, enmState))
557 rtTimerLnxCallbackDestroy(pTimer, pSubTimer);
573 * @param pSubTimer The sub-timer.
575 static bool rtTimerLnxChangeToCallbackStateSlow(PRTTIMERLNXSUBTIMER pSubTimer)
579 RTTIMERLNXSTATE enmState = rtTimerLnxGetState(&pSubTimer->enmState);
585 if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_CALLBACK, enmState))
606 * @param pSubTimer The sub-timer.
608 DECLINLINE(bool) rtTimerLnxChangeToCallbackState(PRTTIMERLNXSUBTIMER pSubTimer)
610 if (RT_LIKELY(rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_CALLBACK, RTTIMERLNXSTATE_ACTIVE)))
612 return rtTimerLnxChangeToCallbackStateSlow(pSubTimer);
626 PRTTIMERLNXSUBTIMER pSubTimer = RT_FROM_MEMBER(pHrTimer, RTTIMERLNXSUBTIMER, u.Hr.LnxTimer);
627 PRTTIMER pTimer = pSubTimer->pParent;
631 if (RT_UNLIKELY(!rtTimerLnxChangeToCallbackState(pSubTimer)))
642 ? (RTCPUID)(pSubTimer - &pTimer->aSubTimers[0]) != idCpu
645 rtTimerLnxCallbackHandleMigration(pTimer, pSubTimer);
658 pTimer->pfnTimer(pTimer, pTimer->pvUser, ++pSubTimer->iTick);
659 hrtimer_add_expires_ns(&pSubTimer->u.Hr.LnxTimer, ASMAtomicReadU64(&pTimer->u64NanoInterval));
660 if (RT_LIKELY(rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_ACTIVE, RTTIMERLNXSTATE_CALLBACK)))
671 pTimer->pfnTimer(pTimer, pTimer->pvUser, ++pSubTimer->iTick);
672 if (RT_LIKELY(rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_STOPPED, RTTIMERLNXSTATE_CALLBACK)))
681 RTTIMERLNXSTATE enmState = rtTimerLnxGetState(&pSubTimer->enmState);
685 rtTimerLnxCallbackDestroy(pTimer, pSubTimer);
689 if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_STOPPED, RTTIMERLNXSTATE_CB_STOPPING))
694 if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_ACTIVE, RTTIMERLNXSTATE_CB_RESTARTING))
696 pSubTimer->iTick = 0;
697 hrtimer_set_expires(&pSubTimer->u.Hr.LnxTimer, rtTimerLnxNanoToKt(pSubTimer->uNsRestartAt));
719 PRTTIMERLNXSUBTIMER pSubTimer = (PRTTIMERLNXSUBTIMER)ulUser;
720 PRTTIMER pTimer = pSubTimer->pParent;
723 if (RT_UNLIKELY(!rtTimerLnxChangeToCallbackState(pSubTimer)))
734 ? (RTCPUID)(pSubTimer - &pTimer->aSubTimers[0]) != idCpu
737 rtTimerLnxCallbackHandleMigration(pTimer, pSubTimer);
751 const uint64_t iTick = ++pSubTimer->iTick;
759 if (RT_UNLIKELY(pSubTimer->u.Std.fFirstAfterChg))
761 pSubTimer->u.Std.fFirstAfterChg = false;
762 pSubTimer->u.Std.u64NextTS = RTTimeSystemNanoTS();
763 pSubTimer->u.Std.ulNextJiffies = jiffies;
767 pSubTimer->u.Std.u64NextTS += u64NanoInterval;
770 pSubTimer->u.Std.ulNextJiffies += cJiffies;
773 while (time_before(pSubTimer->u.Std.ulNextJiffies, jiffies))
775 pSubTimer->u.Std.ulNextJiffies += cJiffies;
776 pSubTimer->u.Std.u64NextTS += u64NanoInterval;
782 while (pSubTimer->u.Std.u64NextTS < u64NanoTS)
783 pSubTimer->u.Std.u64NextTS += u64NanoInterval;
784 pSubTimer->u.Std.ulNextJiffies = jiffies + rtTimerLnxNanoToJiffies(pSubTimer->u.Std.u64NextTS - u64NanoTS);
795 if (RT_LIKELY(rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_ACTIVE, RTTIMERLNXSTATE_CALLBACK)))
799 mod_timer_pinned(&pSubTimer->u.Std.LnxTimer, pSubTimer->u.Std.ulNextJiffies);
802 mod_timer(&pSubTimer->u.Std.LnxTimer, pSubTimer->u.Std.ulNextJiffies);
814 pTimer->pfnTimer(pTimer, pTimer->pvUser, ++pSubTimer->iTick);
815 if (RT_LIKELY(rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_STOPPED, RTTIMERLNXSTATE_CALLBACK)))
824 RTTIMERLNXSTATE enmState = rtTimerLnxGetState(&pSubTimer->enmState);
828 rtTimerLnxCallbackDestroy(pTimer, pSubTimer);
832 if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_STOPPED, RTTIMERLNXSTATE_CB_STOPPING))
837 if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_ACTIVE, RTTIMERLNXSTATE_CB_RESTARTING))
844 u64NextTS = pSubTimer->uNsRestartAt;
846 pSubTimer->iTick = 0;
847 pSubTimer->u.Std.u64NextTS = u64NextTS;
848 pSubTimer->u.Std.fFirstAfterChg = true;
849 pSubTimer->u.Std.ulNextJiffies = u64NextTS > u64NanoTS
856 mod_timer_pinned(&pSubTimer->u.Std.LnxTimer, pSubTimer->u.Std.ulNextJiffies);
859 mod_timer(&pSubTimer->u.Std.LnxTimer, pSubTimer->u.Std.ulNextJiffies);
1062 PRTTIMERLNXSUBTIMER pSubTimer = &pTimer->aSubTimers[idCpu];
1063 if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_MP_STARTING, RTTIMERLNXSTATE_STOPPED))
1064 rtTimerLnxStartSubTimer(pSubTimer, pArgs->u64Now, pArgs->u64First, true /*fPinned*/, pTimer->fHighRes);
1082 PRTTIMERLNXSUBTIMER pSubTimer = &pTimer->aSubTimers[idCpu];
1109 if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_MP_STARTING, RTTIMERLNXSTATE_STOPPED))
1116 rtTimerLnxStartSubTimer(pSubTimer, Args.u64Now, Args.u64First, true /*fPinned*/, pTimer->fHighRes);
1119 rtTimerLnxSetState(&pSubTimer->enmState, RTTIMERLNXSTATE_STOPPED); /* we'll recheck it. */
1137 while ( (enmState = rtTimerLnxGetState(&pSubTimer->enmState)) == RTTIMERLNXSTATE_ACTIVE
1143 if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_MP_STOPPING, RTTIMERLNXSTATE_ACTIVE))
1147 rtTimerLnxStopSubTimer(pSubTimer, pTimer->fHighRes);
1151 else if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_CB_STOPPING, enmState))