[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.01.0910120828390.3438@localhost.localdomain>
Date: Mon, 12 Oct 2009 08:36:38 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Simon Kagstrom <simon.kagstrom@...insight.net>
cc: Ingo Molnar <mingo@...e.hu>,
Artem Bityutskiy <dedekind1@...il.com>,
David Woodhouse <dwmw2@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
"Koskinen Aaro (Nokia-D/Helsinki)" <aaro.koskinen@...ia.com>,
linux-mtd <linux-mtd@...ts.infradead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alan Cox <alan@...rguk.ukuu.org.uk>
Subject: Re: [PATCH] panic.c: export panic_on_oops
On Mon, 12 Oct 2009, Simon Kagstrom wrote:
>
> Well, this is what my patch [1] aims to fix. What it does is to put all
> messages in a circular buffer, and when an oops or panic occurs it
> writes them out.
Umm. That's wrong. We already _have_ the circular buffer.
It's called 'log_buf'.
I agree with the "save kernel buffer on panic" thing, but I disagree with
making it anything new, and hooking into "printk()" or the console
subsystem AT ALL. That's just bogus, stupid, and WRONG.
What you can do is to just flush the 'log_buf' buffer (or as much of it as
you want - the buffer may be a megabyte in size, and maybe you only want
to flush the last 8kB or something like that) on oops. And _not_ mix this
up with anything else. It's a really simple circular buffer, which just
has
- log_buf: buffer start
- log_end: number of characters ever seen
- log_buf_len: size of buffer (guaranteed to be a power-of-2)
so it's literally as easy as looking at those three values (there's a few
more that you _can_ look at, but they'd not likely be relevant for a
"panic_on_oops" thing)
> The current version only collects messages _during_ an
> oops. I'll rework it with using kfifo as per Alans suggestion though.
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.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists