Patchwork [v1,1/1] powerpc: to access local paca after hard irq disabled

login
register
mail settings
Submitter Tiejun Chen
Date July 15, 2013, 2:36 a.m.
Message ID <1373855764-5115-1-git-send-email-tiejun.chen@windriver.com>
Download mbox | patch
Permalink /patch/258930/
State Accepted, archived
Commit 0b88f772bdf2847461debf417b1ee96043a7cb1b
Headers show

Comments

Tiejun Chen - July 15, 2013, 2:36 a.m.
We can access paca directly after hard interrupt disabled, and
this can avoid accessing wrong paca when using get_paca() in
preempt case.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/include/asm/hw_irq.h |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index ba713f1..10be1dd 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -96,10 +96,11 @@  static inline bool arch_irqs_disabled(void)
 #endif
 
 #define hard_irq_disable()	do {			\
-	u8 _was_enabled = get_paca()->soft_enabled;	\
+	u8 _was_enabled;				\
 	__hard_irq_disable();				\
-	get_paca()->soft_enabled = 0;			\
-	get_paca()->irq_happened |= PACA_IRQ_HARD_DIS;	\
+	_was_enabled = local_paca->soft_enabled;	\
+	local_paca->soft_enabled = 0;			\
+	local_paca->irq_happened |= PACA_IRQ_HARD_DIS;	\
 	if (_was_enabled)				\
 		trace_hardirqs_off();			\
 } while(0)