powerpc/time: avoid programming DEC at the start of the timer interrupt
[sfrench/cifs-2.6.git] / arch / powerpc / kernel / time.c
index ae3e33b4ef95faaa692414e4dff1c7905589f4ff..a2ab397065c6667bdd26a2dcbd6561984b2158ed 100644 (file)
@@ -532,22 +532,23 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(timer_interrupt)
                return;
        }
 
-       /*
-        * Ensure a positive value is written to the decrementer, or
-        * else some CPUs will continue to take decrementer exceptions.
-        * When the PPC_WATCHDOG (decrementer based) is configured,
-        * keep this at most 31 bits, which is about 4 seconds on most
-        * systems, which gives the watchdog a chance of catching timer
-        * interrupt hard lockups.
-        */
-       if (IS_ENABLED(CONFIG_PPC_WATCHDOG))
-               set_dec(0x7fffffff);
-       else
-               set_dec(decrementer_max);
-
        /* Conditionally hard-enable interrupts. */
-       if (should_hard_irq_enable())
+       if (should_hard_irq_enable()) {
+               /*
+                * Ensure a positive value is written to the decrementer, or
+                * else some CPUs will continue to take decrementer exceptions.
+                * When the PPC_WATCHDOG (decrementer based) is configured,
+                * keep this at most 31 bits, which is about 4 seconds on most
+                * systems, which gives the watchdog a chance of catching timer
+                * interrupt hard lockups.
+                */
+               if (IS_ENABLED(CONFIG_PPC_WATCHDOG))
+                       set_dec(0x7fffffff);
+               else
+                       set_dec(decrementer_max);
+
                do_hard_irq_enable();
+       }
 
 #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
        if (atomic_read(&ppc_n_lost_interrupts) != 0)