VirtualBox

Changeset 27194 in vbox for trunk/src


Ignore:
Timestamp:
Mar 9, 2010 9:13:35 AM (15 years ago)
Author:
vboxsync
Message:

r0drv/linux/timer: adapt to Linux kernels >= 2.6.31 where mod_timer() does not pin the timer to the current CPU core anymore

File:
1 edited

Legend:

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

    r25427 r27194  
    5959 && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
    6060# error "RT_USE_LINUX_HRTIMER requires 2.6.28 or later, sorry."
     61#endif
     62
     63#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
     64# define mod_timer_pinned       mod_timer
    6165#endif
    6266
     
    266270 * @param   u64Now      The current timestamp (RTTimeNanoTS()).
    267271 * @param   u64First    The interval from u64Now to the first time the timer should fire.
    268  */
    269 static void rtTimerLnxStartSubTimer(PRTTIMERLNXSUBTIMER pSubTimer, uint64_t u64Now, uint64_t u64First)
     272 * @param   fPinned     true = timer pinned to a specific CPU,
     273 *                      false = timer can migrate between CPUs
     274 */
     275static void rtTimerLnxStartSubTimer(PRTTIMERLNXSUBTIMER pSubTimer, uint64_t u64Now, uint64_t u64First, bool fPinned)
    270276{
    271277    /*
     
    286292        unsigned long cJiffies = !u64First ? 0 : rtTimerLnxNanoToJiffies(u64First);
    287293        pSubTimer->ulNextJiffies = jiffies + cJiffies;
    288         mod_timer(&pSubTimer->LnxTimer, pSubTimer->ulNextJiffies);
     294        if (fPinned)
     295            mod_timer_pinned(&pSubTimer->LnxTimer, pSubTimer->ulNextJiffies);
     296        else
     297            mod_timer(&pSubTimer->LnxTimer, pSubTimer->ulNextJiffies);
    289298    }
    290299#endif
     
    412421        }
    413422
    414         mod_timer(&pSubTimer->LnxTimer, pSubTimer->ulNextJiffies);
     423        if (pTimer->fSpecificCpu || pTimer->fAllCpus)
     424            mod_timer_pinned(&pSubTimer->LnxTimer, pSubTimer->ulNextJiffies);
     425        else
     426            mod_timer(&pSubTimer->LnxTimer, pSubTimer->ulNextJiffies);
    415427#endif
    416428
     
    441453    PRTTIMER pTimer = (PRTTIMER)pvUser1;
    442454    Assert(idCpu < pTimer->cCpus);
    443     rtTimerLnxStartSubTimer(&pTimer->aSubTimers[idCpu], pArgs->u64Now, pArgs->u64First);
     455    rtTimerLnxStartSubTimer(&pTimer->aSubTimers[idCpu], pArgs->u64Now, pArgs->u64First, true /*fPinned*/);
    444456}
    445457
     
    593605            PRTTIMERLNXSUBTIMER pSubTimer = &pTimer->aSubTimers[idCpu];
    594606            if (rtTimerLnxCmpXchgState(&pSubTimer->enmState, RTTIMERLNXSTATE_MP_STARTING, RTTIMERLNXSTATE_STOPPED))
    595                 rtTimerLnxStartSubTimer(pSubTimer, pArgs->u64Now, pArgs->u64First);
     607                rtTimerLnxStartSubTimer(pSubTimer, pArgs->u64Now, pArgs->u64First, true /*fPinned*/);
    596608        }
    597609
     
    646658
    647659                    if (RTMpCpuId() == idCpu)
    648                         rtTimerLnxStartSubTimer(pSubTimer, Args.u64Now, Args.u64First);
     660                        rtTimerLnxStartSubTimer(pSubTimer, Args.u64Now, Args.u64First, true /*fPinned*/);
    649661                    else
    650662                    {
     
    694706    PRTTIMERLINUXSTARTONCPUARGS pArgs = (PRTTIMERLINUXSTARTONCPUARGS)pvUser2;
    695707    PRTTIMER pTimer = (PRTTIMER)pvUser1;
    696     rtTimerLnxStartSubTimer(&pTimer->aSubTimers[0], pArgs->u64Now, pArgs->u64First);
     708    rtTimerLnxStartSubTimer(&pTimer->aSubTimers[0], pArgs->u64Now, pArgs->u64First, true /*fPinned*/);
    697709}
    698710
     
    728740    ASMAtomicWriteBool(&pTimer->fSuspended, false);
    729741    if (!pTimer->fSpecificCpu)
    730         rtTimerLnxStartSubTimer(&pTimer->aSubTimers[0], Args.u64Now, Args.u64First);
     742        rtTimerLnxStartSubTimer(&pTimer->aSubTimers[0], Args.u64Now, Args.u64First, false /*fPinned*/);
    731743    else
    732744    {
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