Skip to contentSkip to conversation

panic: Call console_verbose in panic

PATCH In review Anton Blanchard 4 participants 4 messages May 10, 2010 – May 13, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 panic: Call console_verbose in panic

Most distros turn the console verbosity down and that means a backtrace after a panic never makes it to the console. I assume we haven't seen this because a panic is often preceeded by an oops which will have called console_verbose. There are however a lot of places we call panic directly, and they are broken.

Use console_verbose like we do in the oops path to ensure a directly called panic will print a backtrace.

---

kernel/panic.c +1 -0
Index: linux-2.6/kernel/panic.c
===================================================================
@@ -87,6 +87,7 @@ NORET_TYPE void panic(const char * fmt, 
 	 */
 	preempt_disable();
 
+	console_verbose();
 	bust_spinlocks(1);
 	va_start(args, fmt);
 	vsnprintf(buf, sizeof(buf), fmt, args);
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Anton Blanchard

Most distros turn the console verbosity down and that means a backtrace after a panic never makes it to the console. I assume we haven't seen this because a panic is often preceeded by an oops which will have called console_verbose. There are however a lot of places we call panic directly, and they are broken.

Use console_verbose like we do in the oops path to ensure a directly called panic will print a backtrace.

Looks good to me:

thanks,

greg k-h

#2 lore raw
In reply to Anton Blanchard
Quoted 18 lines · On Tue, 11 May 2010 08:59:59 +1000 Anton Blanchard <[email protected]> wrote:

Most distros turn the console verbosity down and that means a backtrace after a panic never makes it to the console. I assume we haven't seen this because a panic is often preceeded by an oops which will have called console_verbose. There are however a lot of places we call panic directly, and they are broken.

Use console_verbose like we do in the oops path to ensure a directly called panic will print a backtrace.

---

Index: linux-2.6/kernel/panic.c
===================================================================

kernel/panic.c NORET_TYPE void panic(const char * fmt, · line 93

Quoted 7 lines
kernel/panic.c +1 -0
@@ -87,6 +87,7 @@ NORET_TYPE void panic(const char * fmt, 
 	 */
 	preempt_disable();
 
+	console_verbose();
 	bust_spinlocks(1);
 	va_start(args, fmt);
 	vsnprintf(buf, sizeof(buf), fmt, args);

hm, console_verbose() is interesting:

: static inline void console_verbose(void)
: {
: if (console_loglevel)
: console_loglevel = 15;
: }

so if someone has run console_silent():

: static inline void console_silent(void)
: {
: console_loglevel = 0;
: }

then console_verbose() doesn't work.

The sole caller of console_silent() is arch/mn10300/kernel/mn10300-watchdog.c:watchdog_interrupt(), which makes me wonder if mn10300 is doing something wrong or outdated?

#3 lore raw
Quoted 3 lines · Andrew Morton

The sole caller of console_silent() is arch/mn10300/kernel/mn10300-watchdog.c:watchdog_interrupt(), which makes me wonder if mn10300 is doing something wrong or outdated?

The MN10300 code will have been copied from elsewhere, so it may well be outdated.

David