xen: ARM: suspend the tick (if in use) when going idle.
authorDario Faggioli <dario.faggioli@citrix.com>
Wed, 30 Aug 2017 11:06:20 +0000 (12:06 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 30 Aug 2017 11:06:20 +0000 (12:06 +0100)
Since commit 964fae8ac ("cpuidle: suspend/resume scheduler
tick timer during cpu idle state entry/exit"), if a scheduler
has a periodic tick timer, we stop it when going idle.

This, however, is only true for x86. Make it true for ARM as
well.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/arch/arm/domain.c

index ee0886ee7d1b15d9b741073782df6ccc4c59a83d..6512f01463a8df2b22423fea96dfddf323d37fd4 100644 (file)
 
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
 
+static void do_idle(void)
+{
+    unsigned int cpu = smp_processor_id();
+
+    sched_tick_suspend();
+    /* sched_tick_suspend() can raise TIMER_SOFTIRQ. Process it now. */
+    process_pending_softirqs();
+
+    local_irq_disable();
+    if ( cpu_is_haltable(cpu) )
+    {
+        dsb(sy);
+        wfi();
+    }
+    local_irq_enable();
+
+    sched_tick_resume();
+}
+
 void idle_loop(void)
 {
     unsigned int cpu = smp_processor_id();
@@ -58,15 +77,7 @@ void idle_loop(void)
          */
         else if ( !softirq_pending(cpu) && !scrub_free_pages() &&
                   !softirq_pending(cpu) )
-        {
-            local_irq_disable();
-            if ( cpu_is_haltable(cpu) )
-            {
-                dsb(sy);
-                wfi();
-            }
-            local_irq_enable();
-        }
+            do_idle();
 
         do_softirq();
         /*