Commit 0dafafc3 authored by Vineet Gupta's avatar Vineet Gupta

ARC: Add support for irqflags tracing and lockdep

Lockdep required a small fix to stacktrace API which was incorrectly
unwindign out of __switch_to for the current call frame.
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent 54c8bff1
...@@ -35,6 +35,12 @@ config ARC ...@@ -35,6 +35,12 @@ config ARC
select PERF_USE_VMALLOC select PERF_USE_VMALLOC
select HAVE_DEBUG_STACKOVERFLOW select HAVE_DEBUG_STACKOVERFLOW
config TRACE_IRQFLAGS_SUPPORT
def_bool y
config LOCKDEP_SUPPORT
def_bool y
config SCHED_OMIT_FRAME_POINTER config SCHED_OMIT_FRAME_POINTER
def_bool y def_bool y
......
...@@ -151,16 +151,38 @@ static inline void arch_unmask_irq(unsigned int irq) ...@@ -151,16 +151,38 @@ static inline void arch_unmask_irq(unsigned int irq)
#else #else
#ifdef CONFIG_TRACE_IRQFLAGS
.macro TRACE_ASM_IRQ_DISABLE
bl trace_hardirqs_off
.endm
.macro TRACE_ASM_IRQ_ENABLE
bl trace_hardirqs_on
.endm
#else
.macro TRACE_ASM_IRQ_DISABLE
.endm
.macro TRACE_ASM_IRQ_ENABLE
.endm
#endif
.macro IRQ_DISABLE scratch .macro IRQ_DISABLE scratch
lr \scratch, [status32] lr \scratch, [status32]
bic \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) bic \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK)
flag \scratch flag \scratch
TRACE_ASM_IRQ_DISABLE
.endm .endm
.macro IRQ_ENABLE scratch .macro IRQ_ENABLE scratch
lr \scratch, [status32] lr \scratch, [status32]
or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK)
flag \scratch flag \scratch
TRACE_ASM_IRQ_ENABLE
.endm .endm
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
......
...@@ -250,6 +250,14 @@ ARC_ENTRY handle_interrupt_level1 ...@@ -250,6 +250,14 @@ ARC_ENTRY handle_interrupt_level1
lr r0, [icause1] lr r0, [icause1]
and r0, r0, 0x1f and r0, r0, 0x1f
#ifdef CONFIG_TRACE_IRQFLAGS
; icause1 needs to be read early, before calling tracing, which
; can clobber scratch regs, hence use of stack to stash it
push r0
TRACE_ASM_IRQ_DISABLE
pop r0
#endif
bl.d @arch_do_IRQ bl.d @arch_do_IRQ
mov r1, sp mov r1, sp
...@@ -570,6 +578,7 @@ resume_user_mode_begin: ...@@ -570,6 +578,7 @@ resume_user_mode_begin:
; --- (Slow Path #2) pending signal --- ; --- (Slow Path #2) pending signal ---
mov r0, sp ; pt_regs for arg to do_signal()/do_notify_resume() mov r0, sp ; pt_regs for arg to do_signal()/do_notify_resume()
GET_CURR_THR_INFO_FLAGS r9
bbit0 r9, TIF_SIGPENDING, .Lchk_notify_resume bbit0 r9, TIF_SIGPENDING, .Lchk_notify_resume
; Normal Trap/IRQ entry only saves Scratch (caller-saved) regs ; Normal Trap/IRQ entry only saves Scratch (caller-saved) regs
...@@ -635,6 +644,8 @@ resume_kernel_mode: ...@@ -635,6 +644,8 @@ resume_kernel_mode:
restore_regs : restore_regs :
TRACE_ASM_IRQ_ENABLE
lr r10, [status32] lr r10, [status32]
; Restore REG File. In case multiple Events outstanding, ; Restore REG File. In case multiple Events outstanding,
......
...@@ -237,11 +237,13 @@ unsigned int get_wchan(struct task_struct *tsk) ...@@ -237,11 +237,13 @@ unsigned int get_wchan(struct task_struct *tsk)
*/ */
void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
{ {
/* Assumes @tsk is sleeping so unwinds from __switch_to */
arc_unwind_core(tsk, NULL, __collect_all_but_sched, trace); arc_unwind_core(tsk, NULL, __collect_all_but_sched, trace);
} }
void save_stack_trace(struct stack_trace *trace) void save_stack_trace(struct stack_trace *trace)
{ {
arc_unwind_core(current, NULL, __collect_all, trace); /* Pass NULL for task so it unwinds the current call frame */
arc_unwind_core(NULL, NULL, __collect_all, trace);
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment