Re: [PATCH] panic.c: export panic_on_oops

Linus Torvalds
2009-10-12T15:44:30Z

On Mon, 12 Oct 2009, Linus Torvalds wrote:
>
> Don't. kfifo's aren't going to help. You're doing this at all the wrong
> levels ENTIRELY, and we already have the buffer you want to flush.

Btw, a few simple rules:

- if you need to make your device look like a "console device" for
dumping at oops time, you're doing things wrong. You don't want line
buffered output to begin with, and you don't want to see each line, you
only want this at exceptional points.

- if you need to look at "in_interrupt()" or "panic_on_oops", you're
doing things wrong.

- if you add your own buffers, you're doing things wrong. I have
CONFIG_LOG_BUF_SHIFT=18 in my kernel, so I've already got 256kB worth
of memory allocated for kernel messages. Sometimes I increase that
further, just because I do some silly printk debugging.

IOW, just add a very simple "flush the dmesg buffer on oops" callback to
the end of the oops printout code (just a single call after the oops thing
is now known to be in the dmesg buffers!)

It's not just oopses, btw. Maybe people would like to do this as the last
stage of a reboot/shutdown too. Because some of the final printouts from
the shutdown will never make it to disk, because 'ksyslogd' has been
killed, and the root filesystem has been turned read-only.

Linus