APIC timer needs rearming before halting the cpu

- time stops if there is no activity and the timer expired before
  we halted the cpu

- restart_local_timer() checks if the timer has expired and if so it
  restarts it

- we do the same when switching back to userspace
This commit is contained in:
Tomas Hruby 2011-05-11 11:54:23 +02:00
parent f5a1e58f59
commit bed9e48c12

View file

@ -206,11 +206,19 @@ PRIVATE void idle(void)
switch_address_space_idle();
#ifdef CONFIG_SMP
get_cpulocal_var(cpu_is_idle) = 1;
/* we don't need to keep time on APs as it is handled on the BSP */
if (cpuid != bsp_cpu_id)
stop_local_timer();
get_cpulocal_var(cpu_is_idle) = 1;
else
#endif
{
/*
* If the timer has expired while in kernel we must
* rearm it before we go to sleep
*/
restart_local_timer();
}
/* start accounting for the idle time */
context_stop(proc_addr(KERNEL));