Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / x86 / kernel / stacktrace.c
blob2f28af966b4c9d5e99705f4ee40fac1407bc9512
1 /*
2 * Stack trace management functions
4 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
5 */
6 #include <linux/sched.h>
7 #include <linux/stacktrace.h>
8 #include <linux/module.h>
9 #include <asm/stacktrace.h>
11 static void save_stack_warning(void *data, char *msg)
15 static void
16 save_stack_warning_symbol(void *data, char *msg, unsigned long symbol)
20 static int save_stack_stack(void *data, char *name)
22 return -1;
25 static void save_stack_address(void *data, unsigned long addr, int reliable)
27 struct stack_trace *trace = data;
28 <<<<<<< HEAD:arch/x86/kernel/stacktrace.c
29 =======
30 if (!reliable)
31 return;
32 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/x86/kernel/stacktrace.c
33 if (trace->skip > 0) {
34 trace->skip--;
35 return;
37 if (trace->nr_entries < trace->max_entries)
38 trace->entries[trace->nr_entries++] = addr;
41 static void
42 save_stack_address_nosched(void *data, unsigned long addr, int reliable)
44 struct stack_trace *trace = (struct stack_trace *)data;
45 <<<<<<< HEAD:arch/x86/kernel/stacktrace.c
46 =======
47 if (!reliable)
48 return;
49 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/x86/kernel/stacktrace.c
50 if (in_sched_functions(addr))
51 return;
52 if (trace->skip > 0) {
53 trace->skip--;
54 return;
56 if (trace->nr_entries < trace->max_entries)
57 trace->entries[trace->nr_entries++] = addr;
60 static const struct stacktrace_ops save_stack_ops = {
61 .warning = save_stack_warning,
62 .warning_symbol = save_stack_warning_symbol,
63 .stack = save_stack_stack,
64 .address = save_stack_address,
67 static const struct stacktrace_ops save_stack_ops_nosched = {
68 .warning = save_stack_warning,
69 .warning_symbol = save_stack_warning_symbol,
70 .stack = save_stack_stack,
71 .address = save_stack_address_nosched,
75 * Save stack-backtrace addresses into a stack_trace buffer.
77 void save_stack_trace(struct stack_trace *trace)
79 dump_trace(current, NULL, NULL, 0, &save_stack_ops, trace);
80 if (trace->nr_entries < trace->max_entries)
81 trace->entries[trace->nr_entries++] = ULONG_MAX;
84 void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
86 dump_trace(tsk, NULL, NULL, 0, &save_stack_ops_nosched, trace);
87 if (trace->nr_entries < trace->max_entries)
88 trace->entries[trace->nr_entries++] = ULONG_MAX;