Commit e1e16115 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Ralf Baechle

MIPS: Add LATENCYTOP support

Add LATENCYTOP support for MIPS. Tested on OCTEON.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/11353/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 972cfd55
...@@ -2759,6 +2759,10 @@ config STACKTRACE_SUPPORT ...@@ -2759,6 +2759,10 @@ config STACKTRACE_SUPPORT
bool bool
default y default y
config HAVE_LATENCYTOP_SUPPORT
bool
default y
config PGTABLE_LEVELS config PGTABLE_LEVELS
int int
default 3 if 64BIT && !PAGE_SIZE_64KB default 3 if 64BIT && !PAGE_SIZE_64KB
......
...@@ -12,14 +12,15 @@ ...@@ -12,14 +12,15 @@
* Save stack-backtrace addresses into a stack_trace buffer: * Save stack-backtrace addresses into a stack_trace buffer:
*/ */
static void save_raw_context_stack(struct stack_trace *trace, static void save_raw_context_stack(struct stack_trace *trace,
unsigned long reg29) unsigned long reg29, int savesched)
{ {
unsigned long *sp = (unsigned long *)reg29; unsigned long *sp = (unsigned long *)reg29;
unsigned long addr; unsigned long addr;
while (!kstack_end(sp)) { while (!kstack_end(sp)) {
addr = *sp++; addr = *sp++;
if (__kernel_text_address(addr)) { if (__kernel_text_address(addr) &&
(savesched || !in_sched_functions(addr))) {
if (trace->skip > 0) if (trace->skip > 0)
trace->skip--; trace->skip--;
else else
...@@ -31,7 +32,7 @@ static void save_raw_context_stack(struct stack_trace *trace, ...@@ -31,7 +32,7 @@ static void save_raw_context_stack(struct stack_trace *trace,
} }
static void save_context_stack(struct stack_trace *trace, static void save_context_stack(struct stack_trace *trace,
struct task_struct *tsk, struct pt_regs *regs) struct task_struct *tsk, struct pt_regs *regs, int savesched)
{ {
unsigned long sp = regs->regs[29]; unsigned long sp = regs->regs[29];
#ifdef CONFIG_KALLSYMS #ifdef CONFIG_KALLSYMS
...@@ -43,20 +44,22 @@ static void save_context_stack(struct stack_trace *trace, ...@@ -43,20 +44,22 @@ static void save_context_stack(struct stack_trace *trace,
(unsigned long)task_stack_page(tsk); (unsigned long)task_stack_page(tsk);
if (stack_page && sp >= stack_page && if (stack_page && sp >= stack_page &&
sp <= stack_page + THREAD_SIZE - 32) sp <= stack_page + THREAD_SIZE - 32)
save_raw_context_stack(trace, sp); save_raw_context_stack(trace, sp, savesched);
return; return;
} }
do { do {
if (savesched || !in_sched_functions(pc)) {
if (trace->skip > 0) if (trace->skip > 0)
trace->skip--; trace->skip--;
else else
trace->entries[trace->nr_entries++] = pc; trace->entries[trace->nr_entries++] = pc;
if (trace->nr_entries >= trace->max_entries) if (trace->nr_entries >= trace->max_entries)
break; break;
}
pc = unwind_stack(tsk, &sp, pc, &ra); pc = unwind_stack(tsk, &sp, pc, &ra);
} while (pc); } while (pc);
#else #else
save_raw_context_stack(trace, sp); save_raw_context_stack(trace, sp, savesched);
#endif #endif
} }
...@@ -82,6 +85,6 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) ...@@ -82,6 +85,6 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
regs->cp0_epc = tsk->thread.reg31; regs->cp0_epc = tsk->thread.reg31;
} else } else
prepare_frametrace(regs); prepare_frametrace(regs);
save_context_stack(trace, tsk, regs); save_context_stack(trace, tsk, regs, tsk == current);
} }
EXPORT_SYMBOL_GPL(save_stack_trace_tsk); EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
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