[PATCH]: add dmesg log symbols to /proc/vmcoreinfo lists

Neil Horman nhorman at tuxdriver.com
Wed Feb 4 16:41:15 EST 2009

On Wed, Feb 04, 2009 at 07:37:16AM -0800, Eric W. Biederman wrote:
> Neil Horman <nhorman at tuxdriver.com> writes:
> >> 
> >> That aside we aren't currently exporting log_buf_len, so I don't
> >> think this code works actually works.
> >> 
> >> Neil can you add a comment in kernel/printk.c of the algorithm
> >> necessary for external tools to decode the ring buffer?
> >> 
> >> We need the comment because people working on kernel/printk.c
> >> need to know what is happening and without having to review lots
> >> of user space code, and we need the comment to verify that we
> >> are exporting the right things.
> >> 
> >
> > Ok, as per Erics comment, I've written this.  It applies on top of whats already
> > in your tree Andrew.  It adds some comments on the function in question so that
> > anyone working on printk.c will know why we're exporting their symbols.  It also
> > modifies slightly the symbols we are exporting so that we can handle dmesg
> > buffers that are longer than the standard PAGE_SIZE configuration, and lets us
> > detect and handle buffer wraps.
> Looks like a good start but what is the algorithm for using the variables?
> Given a kernel core file how do you extract the dmesg ring buffer?
Its the same as for every other symbol in vmcoreinfo:
1) kexec copies the symbol info for each symbol specified from
/sys/kernel/vmcoreinfo to an ELF note in the vmcore pre-defined header when the
kexec kernel is loaded into protected memory

2) on a crash, that ELF note is saved to the vmcore file along with the rest of
the data

3) apps (in this case makedumpfile) reads that ELF note so it knows where to
seek into the vmcore file to find the contents of that symbol.

> It still does not appear obvious to me that you are extracting the
> dmesg ring buffer correctly or easily.
You know this patch doesn't do that right?  The functionality for that is in a
user app (in this case makedumpfile).  I have a patch here:
for makedumpfile that uses this symbol info to extract the dmesg log quite well.
ken'ichi has an updated version to be posted soon which handles ring wrap and
log sizes > PAGE_SIZE as well.


> Eric
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

More information about the kexec mailing list