powerpc: Make hard_irq_disable() do the right thing vs. irq tracing
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 6 May 2013 21:04:02 +0000 (21:04 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 7 May 2013 07:13:57 +0000 (17:13 +1000)
If hard_irq_disable() is called while interrupts are already soft-disabled
(which is the most common case) all is already well.

However you can (and in some cases want) to call it while everything is
enabled (to make sure you don't get a lazy even, for example before entry
into KVM guests) and in this case we need to inform the irq tracer that
the irqs are going off.

We have to change the inline into a macro to avoid an include circular
dependency hell hole.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/hw_irq.h

index e45c4947a772016031e943a7f457e1ce6dd8de95..d615b28dda82ff7e9afed97ddf51815f5d170cca 100644 (file)
@@ -95,15 +95,13 @@ static inline bool arch_irqs_disabled(void)
 #define __hard_irq_disable()   __mtmsrd(local_paca->kernel_msr, 1)
 #endif
 
-static inline void hard_irq_disable(void)
-{
-       __hard_irq_disable();
-       get_paca()->soft_enabled = 0;
-       get_paca()->irq_happened |= PACA_IRQ_HARD_DIS;
-}
-
-/* include/linux/interrupt.h needs hard_irq_disable to be a macro */
-#define hard_irq_disable       hard_irq_disable
+#define hard_irq_disable()     do {                    \
+       __hard_irq_disable();                           \
+       if (local_paca->soft_enabled)                   \
+               trace_hardirqs_off();                   \
+       get_paca()->soft_enabled = 0;                   \
+       get_paca()->irq_happened |= PACA_IRQ_HARD_DIS;  \
+} while(0)
 
 static inline bool lazy_irq_pending(void)
 {