From bed9e48c124f04054916a591afdd35bc75bb21c7 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Wed, 11 May 2011 11:54:23 +0200 Subject: [PATCH] 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 --- kernel/proc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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)); -- 2.44.0