From: Tomas Hruby Date: Wed, 11 May 2011 09:54:23 +0000 (+0200) Subject: APIC timer needs rearming before halting the cpu X-Git-Tag: v3.2.0~562 X-Git-Url: http://zhaoyanbai.com/repos/dnssec-importkey.html?a=commitdiff_plain;h=bed9e48c124f04054916a591afdd35bc75bb21c7;p=minix.git 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 --- diff --git a/kernel/proc.c b/kernel/proc.c index fa374f12b..f14b518ef 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -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));