Commit 7aa89746e89fca8fc722485aaf4454f2b636cf4d
Committed by
Linus Torvalds
1 parent
ce63ad78b5
Exists in
master
and in
7 other branches
[PATCH] i386: fix stack dump loglevel
Recent changes caused part of stack traces from SysRq-T to print at KERN_EMERG loglevel. Also, parts of stack dump during oops were failing to print at that level when they should. Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 39 additions and 18 deletions Side-by-side Diff
arch/i386/kernel/traps.c
... | ... | @@ -112,33 +112,38 @@ |
112 | 112 | p < (void *)tinfo + THREAD_SIZE - 3; |
113 | 113 | } |
114 | 114 | |
115 | +static void print_addr_and_symbol(unsigned long addr, char *log_lvl) | |
116 | +{ | |
117 | + printk(log_lvl); | |
118 | + printk(" [<%08lx>] ", addr); | |
119 | + print_symbol("%s", addr); | |
120 | + printk("\n"); | |
121 | +} | |
122 | + | |
115 | 123 | static inline unsigned long print_context_stack(struct thread_info *tinfo, |
116 | - unsigned long *stack, unsigned long ebp) | |
124 | + unsigned long *stack, unsigned long ebp, | |
125 | + char *log_lvl) | |
117 | 126 | { |
118 | 127 | unsigned long addr; |
119 | 128 | |
120 | 129 | #ifdef CONFIG_FRAME_POINTER |
121 | 130 | while (valid_stack_ptr(tinfo, (void *)ebp)) { |
122 | 131 | addr = *(unsigned long *)(ebp + 4); |
123 | - printk(KERN_EMERG " [<%08lx>] ", addr); | |
124 | - print_symbol("%s", addr); | |
125 | - printk("\n"); | |
132 | + print_addr_and_symbol(addr, log_lvl); | |
126 | 133 | ebp = *(unsigned long *)ebp; |
127 | 134 | } |
128 | 135 | #else |
129 | 136 | while (valid_stack_ptr(tinfo, stack)) { |
130 | 137 | addr = *stack++; |
131 | - if (__kernel_text_address(addr)) { | |
132 | - printk(KERN_EMERG " [<%08lx>]", addr); | |
133 | - print_symbol(" %s", addr); | |
134 | - printk("\n"); | |
135 | - } | |
138 | + if (__kernel_text_address(addr)) | |
139 | + print_addr_and_symbol(addr, log_lvl); | |
136 | 140 | } |
137 | 141 | #endif |
138 | 142 | return ebp; |
139 | 143 | } |
140 | 144 | |
141 | -void show_trace(struct task_struct *task, unsigned long * stack) | |
145 | +static void show_trace_log_lvl(struct task_struct *task, | |
146 | + unsigned long *stack, char *log_lvl) | |
142 | 147 | { |
143 | 148 | unsigned long ebp; |
144 | 149 | |
... | ... | @@ -157,7 +162,7 @@ |
157 | 162 | struct thread_info *context; |
158 | 163 | context = (struct thread_info *) |
159 | 164 | ((unsigned long)stack & (~(THREAD_SIZE - 1))); |
160 | - ebp = print_context_stack(context, stack, ebp); | |
165 | + ebp = print_context_stack(context, stack, ebp, log_lvl); | |
161 | 166 | stack = (unsigned long*)context->previous_esp; |
162 | 167 | if (!stack) |
163 | 168 | break; |
164 | 169 | |
... | ... | @@ -165,8 +170,14 @@ |
165 | 170 | } |
166 | 171 | } |
167 | 172 | |
168 | -void show_stack(struct task_struct *task, unsigned long *esp) | |
173 | +void show_trace(struct task_struct *task, unsigned long * stack) | |
169 | 174 | { |
175 | + show_trace_log_lvl(task, stack, ""); | |
176 | +} | |
177 | + | |
178 | +static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp, | |
179 | + char *log_lvl) | |
180 | +{ | |
170 | 181 | unsigned long *stack; |
171 | 182 | int i; |
172 | 183 | |
173 | 184 | |
174 | 185 | |
175 | 186 | |
... | ... | @@ -178,18 +189,28 @@ |
178 | 189 | } |
179 | 190 | |
180 | 191 | stack = esp; |
181 | - printk(KERN_EMERG); | |
192 | + printk(log_lvl); | |
182 | 193 | for(i = 0; i < kstack_depth_to_print; i++) { |
183 | 194 | if (kstack_end(stack)) |
184 | 195 | break; |
185 | - if (i && ((i % 8) == 0)) | |
186 | - printk("\n" KERN_EMERG " "); | |
196 | + if (i && ((i % 8) == 0)) { | |
197 | + printk("\n"); | |
198 | + printk(log_lvl); | |
199 | + printk(" "); | |
200 | + } | |
187 | 201 | printk("%08lx ", *stack++); |
188 | 202 | } |
189 | - printk("\n" KERN_EMERG "Call Trace:\n"); | |
190 | - show_trace(task, esp); | |
203 | + printk("\n"); | |
204 | + printk(log_lvl); | |
205 | + printk("Call Trace:\n"); | |
206 | + show_trace_log_lvl(task, esp, log_lvl); | |
191 | 207 | } |
192 | 208 | |
209 | +void show_stack(struct task_struct *task, unsigned long *esp) | |
210 | +{ | |
211 | + show_stack_log_lvl(task, esp, ""); | |
212 | +} | |
213 | + | |
193 | 214 | /* |
194 | 215 | * The architecture-independent dump_stack generator |
195 | 216 | */ |
... | ... | @@ -238,7 +259,7 @@ |
238 | 259 | u8 __user *eip; |
239 | 260 | |
240 | 261 | printk("\n" KERN_EMERG "Stack: "); |
241 | - show_stack(NULL, (unsigned long*)esp); | |
262 | + show_stack_log_lvl(NULL, (unsigned long *)esp, KERN_EMERG); | |
242 | 263 | |
243 | 264 | printk(KERN_EMERG "Code: "); |
244 | 265 |