VirtualBox

Ignore:
Timestamp:
Feb 17, 2015 2:57:26 PM (10 years ago)
Author:
vboxsync
Message:

Runtime/r0drv/solaris: fixed forceful rescheduling of timer-callback when firing on the wrong CPU due to a race between cyclic_add() and cyclic_bind().

File:
1 edited

Legend:

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

    r54194 r54233  
    229229    if (!pTimer->fSuspendedFromTimer)
    230230    {
    231         /* For specific timers, we might fire on the wrong CPU between cyclic_add() and cyclic_bind().
    232            Redirect these shots to the right CPU as we are temporarily rebinding to the right CPU. */
    233         if (RT_UNLIKELY(   pTimer->fSpecificCpu
    234                         && pTimer->iCpu != RTMpCpuId())) /* ASSUMES: index == cpuid */
    235         {
    236             RTMpOnSpecific(pTimer->iCpu, rtTimerSolMpCallbackWrapper, pTimer, NULL);
    237             return;
    238         }
     231        /* Make sure we are firing on the right CPU. */
     232        Assert(   !pTimer->fSpecificCpu
     233               || pTimer->iCpu == RTMpCpuId());
    239234
    240235        /* For one-shot, we may allow the callback to restart them. */
     
    558553        pTimer->u.Single.Handler.cyh_level = CY_LOCK_LEVEL;
    559554
     555        /*
     556         * Use a large interval (1 hour) so that we don't get a timer-callback between
     557         * cyclic_add() and cyclic_bind(). Program the correct interval once cyclic_bind() is done.
     558         * See @bugref{7691} comment #20.
     559         */
    560560        pTimer->u.Single.FireTime.cyt_when = RTTimeSystemNanoTS() + u64First;
     561        if (pTimer->fSpecificCpu)
     562            pTimer->u.Single.FireTime.cyt_when += RT_NS_1HOUR;
    561563        pTimer->u.Single.FireTime.cyt_interval = pTimer->cNsInterval != 0
    562564                                               ? pTimer->cNsInterval
     
    567569        pTimer->hCyclicId = cyclic_add(&pTimer->u.Single.Handler, &pTimer->u.Single.FireTime);
    568570        if (pTimer->fSpecificCpu)
     571        {
    569572            cyclic_bind(pTimer->hCyclicId, cpu[pTimer->iCpu], NULL /* cpupart */);
     573            cyclic_reprogram(pTimer->hCyclicId, RTTimeSystemNanoTS() + u64First);
     574        }
    570575    }
    571576
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