Commit 421d085252613c4caf9c4f2fda3c722a9f5bc554

Authored by Jesper Nilsson
1 parent ca36c1fadd

CRIS: Use KALLSYMs if available in call stack dump

Also, print kernel version on oops.

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>

Showing 1 changed file with 34 additions and 27 deletions Side-by-side Diff

arch/cris/kernel/traps.c
... ... @@ -14,6 +14,10 @@
14 14  
15 15 #include <linux/init.h>
16 16 #include <linux/module.h>
  17 +#include <linux/utsname.h>
  18 +#ifdef CONFIG_KALLSYMS
  19 +#include <linux/kallsyms.h>
  20 +#endif
17 21  
18 22 #include <asm/pgtable.h>
19 23 #include <asm/uaccess.h>
20 24  
21 25  
22 26  
... ... @@ -34,25 +38,24 @@
34 38  
35 39 void (*nmi_handler)(struct pt_regs *);
36 40  
37   -void
38   -show_trace(unsigned long *stack)
  41 +void show_trace(unsigned long *stack)
39 42 {
40 43 unsigned long addr, module_start, module_end;
41 44 extern char _stext, _etext;
42 45 int i;
43 46  
44   - printk("\nCall Trace: ");
  47 + pr_err("\nCall Trace: ");
45 48  
46 49 i = 1;
47 50 module_start = VMALLOC_START;
48 51 module_end = VMALLOC_END;
49 52  
50   - while (((long)stack & (THREAD_SIZE-1)) != 0) {
  53 + while (((long)stack & (THREAD_SIZE - 1)) != 0) {
51 54 if (__get_user(addr, stack)) {
52 55 /* This message matches "failing address" marked
53 56 s390 in ksymoops, so lines containing it will
54 57 not be filtered out by ksymoops. */
55   - printk("Failing address 0x%lx\n", (unsigned long)stack);
  58 + pr_err("Failing address 0x%lx\n", (unsigned long)stack);
56 59 break;
57 60 }
58 61 stack++;
59 62  
60 63  
... ... @@ -68,10 +71,14 @@
68 71 if (((addr >= (unsigned long)&_stext) &&
69 72 (addr <= (unsigned long)&_etext)) ||
70 73 ((addr >= module_start) && (addr <= module_end))) {
  74 +#ifdef CONFIG_KALLSYMS
  75 + print_ip_sym(addr);
  76 +#else
71 77 if (i && ((i % 8) == 0))
72   - printk("\n ");
73   - printk("[<%08lx>] ", addr);
  78 + pr_err("\n ");
  79 + pr_err("[<%08lx>] ", addr);
74 80 i++;
  81 +#endif
75 82 }
76 83 }
77 84 }
78 85  
79 86  
80 87  
... ... @@ -111,21 +118,21 @@
111 118  
112 119 stack = sp;
113 120  
114   - printk("\nStack from %08lx:\n ", (unsigned long)stack);
  121 + pr_err("\nStack from %08lx:\n ", (unsigned long)stack);
115 122 for (i = 0; i < kstack_depth_to_print; i++) {
116 123 if (((long)stack & (THREAD_SIZE-1)) == 0)
117 124 break;
118 125 if (i && ((i % 8) == 0))
119   - printk("\n ");
  126 + pr_err("\n ");
120 127 if (__get_user(addr, stack)) {
121 128 /* This message matches "failing address" marked
122 129 s390 in ksymoops, so lines containing it will
123 130 not be filtered out by ksymoops. */
124   - printk("Failing address 0x%lx\n", (unsigned long)stack);
  131 + pr_err("Failing address 0x%lx\n", (unsigned long)stack);
125 132 break;
126 133 }
127 134 stack++;
128   - printk("%08lx ", addr);
  135 + pr_err("%08lx ", addr);
129 136 }
130 137 show_trace(sp);
131 138 }
132 139  
133 140  
134 141  
135 142  
136 143  
137 144  
... ... @@ -139,33 +146,32 @@
139 146 unsigned long *sp = (unsigned long *)rdusp();
140 147 int i;
141 148  
142   - printk("Stack dump [0x%08lx]:\n", (unsigned long)sp);
  149 + pr_err("Stack dump [0x%08lx]:\n", (unsigned long)sp);
143 150 for (i = 0; i < 16; i++)
144   - printk("sp + %d: 0x%08lx\n", i*4, sp[i]);
  151 + pr_err("sp + %d: 0x%08lx\n", i*4, sp[i]);
145 152 return 0;
146 153 }
147 154 #endif
148 155  
149   -void
150   -set_nmi_handler(void (*handler)(struct pt_regs *))
  156 +void set_nmi_handler(void (*handler)(struct pt_regs *))
151 157 {
152 158 nmi_handler = handler;
153 159 arch_enable_nmi();
154 160 }
155 161  
156 162 #ifdef CONFIG_DEBUG_NMI_OOPS
157   -void
158   -oops_nmi_handler(struct pt_regs *regs)
  163 +void oops_nmi_handler(struct pt_regs *regs)
159 164 {
160 165 stop_watchdog();
161 166 oops_in_progress = 1;
162   - printk("NMI!\n");
  167 + pr_err("NMI!\n");
163 168 show_registers(regs);
164 169 oops_in_progress = 0;
  170 + oops_exit();
  171 + pr_err("\n"); /* Flush mtdoops. */
165 172 }
166 173  
167   -static int __init
168   -oops_nmi_register(void)
  174 +static int __init oops_nmi_register(void)
169 175 {
170 176 set_nmi_handler(oops_nmi_handler);
171 177 return 0;
... ... @@ -180,8 +186,7 @@
180 186 * similar to an Oops dump, and if the kernel is configured to be a nice
181 187 * doggy, then halt instead of reboot.
182 188 */
183   -void
184   -watchdog_bite_hook(struct pt_regs *regs)
  189 +void watchdog_bite_hook(struct pt_regs *regs)
185 190 {
186 191 #ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
187 192 local_irq_disable();
... ... @@ -196,8 +201,7 @@
196 201 }
197 202  
198 203 /* This is normally the Oops function. */
199   -void
200   -die_if_kernel(const char *str, struct pt_regs *regs, long err)
  204 +void die_if_kernel(const char *str, struct pt_regs *regs, long err)
201 205 {
202 206 if (user_mode(regs))
203 207 return;
204 208  
205 209  
206 210  
... ... @@ -211,13 +215,17 @@
211 215 stop_watchdog();
212 216 #endif
213 217  
  218 + oops_enter();
214 219 handle_BUG(regs);
215 220  
216   - printk("%s: %04lx\n", str, err & 0xffff);
  221 + pr_err("Linux %s %s\n", utsname()->release, utsname()->version);
  222 + pr_err("%s: %04lx\n", str, err & 0xffff);
217 223  
218 224 show_registers(regs);
219 225  
  226 + oops_exit();
220 227 oops_in_progress = 0;
  228 + pr_err("\n"); /* Flush mtdoops. */
221 229  
222 230 #ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
223 231 reset_watchdog();
... ... @@ -225,8 +233,7 @@
225 233 do_exit(SIGSEGV);
226 234 }
227 235  
228   -void __init
229   -trap_init(void)
  236 +void __init trap_init(void)
230 237 {
231 238 /* Nothing needs to be done */
232 239 }