> Here's a patch based on some discussions I had with Thomas
I recently posted a patch set for powerpc to capture the most recent
oops or panic message in NVRAM:
http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-November/087032.html
It covers a lot of the same ground, and could be adapted to use your
framework. See below for concerns and suggestions. I'd also be
interested in feedback about the design decisions I mention below.
On powerpc, the amount of NVRAM available for this may be as little
as 1-2 Kbytes. The minimal oops report (with essentially no backtrace)
is about 1800 bytes. See below for implications.
We currently read our NVRAM contents via /dev/nvram and the nvram
command. NVRAM is divided up into several "partitions" -- only
one of which is used for the oops/panic report -- so the user-space
code needs to know about how the partitions are laid out. It also
needs to know how much text we actually wrote to the partition, and
whether or not it's compressed. Since the kernel already knows how
to determine all this, it would probably be more convenient to get
at the oops/panic partition through your /sys interface.
Since the amount of text we capture is so tiny, this is unlikely to be
an issue in my case.
Powerpc p Series does, obviously, and we're looking to exploit it in
just this way.
Why not? In our case, we capture every oops and panic report, but keep
only the most recent. Seems like catching the last oops could be useful
if your system hangs thereafter and can't be made to panic. I suggest
you pass along the reason (KMSG_DUMP_OOPS or whatever) and let the
callback decide.
You'd have to serialize the oops handling, I guess, in case multiple
CPUs oops simultaneously. (Gotta fix that in my code.)
This assumes that you always want to capture the last psinfo->data_size
bytes of the printk buffer. Given the small capacity of our NVRAM
partition, I handle the case where the whole oops report doesn't fit.
In that case, I sacrifice the end of the oops report to capture the
beginning. Patch #3 in my set is about this.
/var/log/messages is typically not readable by everybody. This
appears to circumvent that.
Thanks.
Jim Keniston
IBM Linux Technology Center
Beaverton, OR
--