powerpc: Fix WARN_ON in decrementer_check_overflow
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 8 Feb 2012 19:34:13 +0000 (19:34 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 14 Feb 2012 04:01:38 +0000 (15:01 +1100)
We use __get_cpu_var() which triggers a false positive warning
in smp_processor_id() thinking interrupts are enabled (at this
point, they are soft-enabled but hard-disabled).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/irq.c

index 701d4aceb4f4ca72115426e32fb6fdc490370eb9..01e2877e8e04805694695361326ee0613a502fe1 100644 (file)
@@ -118,10 +118,14 @@ static inline notrace void set_soft_enabled(unsigned long enable)
 static inline notrace void decrementer_check_overflow(void)
 {
        u64 now = get_tb_or_rtc();
-       u64 *next_tb = &__get_cpu_var(decrementers_next_tb);
+       u64 *next_tb;
+
+       preempt_disable();
+       next_tb = &__get_cpu_var(decrementers_next_tb);
 
        if (now >= *next_tb)
                set_dec(1);
+       preempt_enable();
 }
 
 notrace void arch_local_irq_restore(unsigned long en)