VirtualBox

Changeset 48182 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 30, 2013 9:30:43 AM (11 years ago)
Author:
vboxsync
Message:

r0drv/solaris/timer: Make one-shot CPU specific timers work, fix periodic CPU specific timers to not lose any fires.

File:
1 edited

Legend:

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

    r48168 r48182  
    125125
    126126/**
     127 * Callback wrapper for specific timers if they happened to have been fired on
     128 * the wrong CPU. See rtTimerSolCallbackWrapper().
     129 *
     130 * @param   idCpu       The CPU this is fired on.
     131 * @param   pvUser1     Opaque pointer to the timer.
     132 * @param   pvUser2     Not used, NULL.
     133 */
     134static void rtTimerSolMpCallbackWrapper(RTCPUID idCpu, void *pvUser1, void *pvUser2)
     135{
     136    PRTTIMER pTimer = (PRTTIMER)pvUser1;
     137    AssertPtrReturnVoid(pTimer);
     138    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     139    Assert(pTimer->iCpu == RTMpCpuId());    /* ASSUMES: index == cpuid */
     140    Assert(pTimer->pSingleTimer);
     141    NOREF(pvUser2);
     142
     143    if (   pTimer->fSuspended
     144        && pTimer->interval == 0)
     145        return;
     146
     147    /* For one-shot specific timers, allow RTTimer to restart them. */
     148    /** @todo cyclic_reprogram() to CY_INFINITY? */
     149    if (pTimer->interval == 0)
     150        pTimer->fSuspended = true;
     151
     152    uint64_t u64Tick = ++pTimer->pSingleTimer->u64Tick;
     153    pTimer->pfnTimer(pTimer, pTimer->pvUser, u64Tick);
     154}
     155
     156
     157/**
    127158 * Callback wrapper for Omni-CPU and single-CPU timers.
    128159 *
     
    139170    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    140171
    141     if (pTimer->fSuspended)
    142         return;
    143 
    144172    if (pTimer->pSingleTimer)
    145173    {
    146         /* For specific periodic timers, we might fire on the wrong CPU between cyclic_add() and cyclic_bind().
    147            Ignore these shots while we are temporarily rebinding to the right CPU. */
     174        if (   pTimer->fSuspended
     175            && pTimer->interval == 0)
     176            return;
     177
     178        /* For specific timers, we might fire on the wrong CPU between cyclic_add() and cyclic_bind().
     179           Redirect these shots to the right CPU as we are temporarily rebinding to the right CPU. */
    148180        if (   pTimer->fSpecificCpu
    149             && pTimer->interval != 0
    150181            && pTimer->iCpu != RTMpCpuId())          /* ASSUMES: index == cpuid */
    151182        {
     183            RTMpOnSpecific(pTimer->iCpu, rtTimerSolMpCallbackWrapper, pTimer, NULL);
    152184            return;
    153185        }
    154186
    155         /* Allow RTTimer to be restarted for one-shot timers. */
     187        /* For one-shot any-cpu timers, allow RTTimer to restart them. */
     188        /** @todo cyclic_reprogram() to CY_INFINITY? */
    156189        if (pTimer->interval == 0)
    157190            pTimer->fSuspended = true;
     191
    158192        uint64_t u64Tick = ++pTimer->pSingleTimer->u64Tick;
    159193        pTimer->pfnTimer(pTimer, pTimer->pvUser, u64Tick);
     
    221255    /* One-shot omni timers are not supported by the cyclic system. */
    222256    if (   (fFlags & RTTIMER_FLAGS_CPU_ALL) == RTTIMER_FLAGS_CPU_ALL
    223         && u64NanoInterval == 0)
    224     {
    225         return VERR_NOT_SUPPORTED;
    226     }
    227 
    228     /* One-shot specific timers are not supported. See rtTimerSolCallbackWrapper(). */
    229     if (   (fFlags & RTTIMER_FLAGS_CPU_ALL) != RTTIMER_FLAGS_CPU_ALL
    230         && (fFlags & RTTIMER_FLAGS_CPU_SPECIFIC)
    231257        && u64NanoInterval == 0)
    232258    {
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