Skip to content

Commit 122edd2

Browse files
Sasha Levinsamueldr
authored andcommitted
ARC: Call trace_hardirqs_on() before enabling irqs
[ Upstream commit 18b43e8 ] trace_hardirqs_on_caller() in lockdep.c expects to be called before, not after interrupts are actually enabled. The following comment in kernel/locking/lockdep.c substantiates this claim: " /* * We're enabling irqs and according to our state above irqs weren't * already enabled, yet we find the hardware thinks they are in fact * enabled.. someone messed up their IRQ state tracing. */ " An example can be found in include/linux/irqflags.h: do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) Without this change, we hit the following DEBUG_LOCKS_WARN_ON. [ 7.760000] ------------[ cut here ]------------ [ 7.760000] WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:2711 resume_user_mode_begin+0x48/0xf0 [ 7.770000] DEBUG_LOCKS_WARN_ON(!irqs_disabled()) [ 7.780000] Modules linked in: [ 7.780000] CPU: 0 PID: 1 Comm: init Not tainted 4.7.0-00003-gc668bb9-dirty torvalds#366 [ 7.790000] [ 7.790000] Stack Trace: [ 7.790000] arc_unwind_core.constprop.1+0xa4/0x118 [ 7.800000] warn_slowpath_fmt+0x72/0x158 [ 7.800000] resume_user_mode_begin+0x48/0xf0 [ 7.810000] ---[ end trace 6f6a7a8fae20d2f0 ]--- Signed-off-by: Daniel Mentz <[email protected]> Cc: <[email protected]> Signed-off-by: Vineet Gupta <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 1b746b5 commit 122edd2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arc/include/asm/irqflags.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ static inline int arch_irqs_disabled(void)
159159
.endm
160160

161161
.macro IRQ_ENABLE scratch
162+
TRACE_ASM_IRQ_ENABLE
162163
lr \scratch, [status32]
163164
or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK)
164165
flag \scratch
165-
TRACE_ASM_IRQ_ENABLE
166166
.endm
167167

168168
#endif /* __ASSEMBLY__ */

0 commit comments

Comments
 (0)