[PATCH 16/19] x86/dumpstack: remove dump_trace()

From: Josh Poimboeuf
Date: Thu Jul 21 2016 - 17:22:40 EST


All previous users of dump_trace() have been converted to use the new
unwind interfaces, so we can remove it.

Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
arch/x86/include/asm/stacktrace.h | 38 +--------------------
arch/x86/kernel/dumpstack_32.c | 35 --------------------
arch/x86/kernel/dumpstack_64.c | 69 ---------------------------------------
3 files changed, 1 insertion(+), 141 deletions(-)

diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h
index c66dece..bb2b74f 100644
--- a/arch/x86/include/asm/stacktrace.h
+++ b/arch/x86/include/asm/stacktrace.h
@@ -42,11 +42,6 @@ static inline bool on_stack(struct stack_info *info, void *addr, size_t len)
addr + len > begin && addr + len <= end);
}

-extern int kstack_depth_to_print;
-
-struct thread_info;
-struct stacktrace_ops;
-
#ifdef CONFIG_FUNCTION_GRAPH_TRACER

unsigned long
@@ -60,38 +55,7 @@ ftrace_graph_ret_addr(struct task_struct *task, int *idx, unsigned long addr)
}
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */

-typedef unsigned long (*walk_stack_t)(struct task_struct *task,
- unsigned long *stack,
- unsigned long bp,
- const struct stacktrace_ops *ops,
- void *data,
- struct stack_info *info,
- int *graph);
-
-extern unsigned long
-print_context_stack(struct task_struct *task,
- unsigned long *stack, unsigned long bp,
- const struct stacktrace_ops *ops, void *data,
- struct stack_info *info, int *graph);
-
-extern unsigned long
-print_context_stack_bp(struct task_struct *task,
- unsigned long *stack, unsigned long bp,
- const struct stacktrace_ops *ops, void *data,
- struct stack_info *info, int *graph);
-
-/* Generic stack tracer with callbacks */
-
-struct stacktrace_ops {
- int (*address)(void *data, unsigned long address, int reliable);
- /* On negative return stop dumping */
- int (*stack)(void *data, const char *name);
- walk_stack_t walk_stack;
-};
-
-void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
- unsigned long *stack, unsigned long bp,
- const struct stacktrace_ops *ops, void *data);
+extern int kstack_depth_to_print;

#ifdef CONFIG_X86_32
#define STACKSLOTS_PER_LINE 8
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index 6a881cc..69b4ddd 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -91,41 +91,6 @@ int get_stack_info(unsigned long *stack, struct task_struct *task,
return -EINVAL;
}

-void dump_trace(struct task_struct *task, struct pt_regs *regs,
- unsigned long *stack, unsigned long bp,
- const struct stacktrace_ops *ops, void *data)
-{
- unsigned long visit_mask = 0;
- int graph = 0;
-
- task = task ? : current;
- stack = stack ? : get_stack_pointer(task, regs);
- bp = bp ? : (unsigned long)get_frame_pointer(task, regs);
-
- for (;;) {
- const char *begin_str, *end_str;
- struct stack_info info;
-
- if (get_stack_info(stack, task, &info, &visit_mask))
- break;
-
- stack_type_str(info.type, &begin_str, &end_str);
-
- if (begin_str && ops->stack(data, begin_str) < 0)
- break;
-
- bp = ops->walk_stack(task, stack, bp, ops, data, &info, &graph);
-
- if (end_str && ops->stack(data, end_str) < 0)
- break;
-
- stack = info.next;
-
- touch_nmi_watchdog();
- }
-}
-EXPORT_SYMBOL(dump_trace);
-
void
show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
unsigned long *sp, char *log_lvl)
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 6e5ccec..b4e3bd3 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -122,75 +122,6 @@ unknown:
return -EINVAL;
}

-/*
- * x86-64 can have up to three kernel stacks:
- * process stack
- * interrupt stack
- * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack
- */
-
-void dump_trace(struct task_struct *task, struct pt_regs *regs,
- unsigned long *stack, unsigned long bp,
- const struct stacktrace_ops *ops, void *data)
-{
- unsigned long visit_mask = 0;
- struct stack_info info;
- int graph = 0;
- int done = 0;
-
- task = task ? : current;
- stack = stack ? : get_stack_pointer(task, regs);
- bp = bp ? : (unsigned long)get_frame_pointer(task, regs);
-
- /*
- * Print function call entries in all stacks, starting at the
- * current stack address. If the stacks consist of nested
- * exceptions
- */
- while (!done) {
- const char *begin_str, *end_str;
-
- get_stack_info(stack, task, &info, &visit_mask);
-
- /* Default finish unless specified to continue */
- done = 1;
-
- switch (info.type) {
-
- /* Break out early if we are on the thread stack */
- case STACK_TYPE_TASK:
- break;
-
- case STACK_TYPE_IRQ:
- case STACK_TYPE_EXCEPTION ... STACK_TYPE_EXCEPTION_LAST:
-
- stack_type_str(info.type, &begin_str, &end_str);
-
- if (ops->stack(data, begin_str) < 0)
- break;
-
- bp = ops->walk_stack(task, stack, bp, ops,
- data, &info, &graph);
-
- ops->stack(data, end_str);
-
- stack = info.next;
- done = 0;
- break;
-
- default:
- ops->stack(data, "UNK");
- break;
- }
- }
-
- /*
- * This handles the process stack:
- */
- bp = ops->walk_stack(task, stack, bp, ops, data, &info, &graph);
-}
-EXPORT_SYMBOL(dump_trace);
-
void show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
unsigned long *sp, char *log_lvl)
{
--
2.7.4