Re: [PATCH RESEND 1/3] printk: convert byte-buffer tovariable-length record buffer

From: Greg KH
Date: Thu Jun 14 2012 - 20:04:23 EST


On Tue, May 29, 2012 at 06:07:00PM +0200, Kay Sievers wrote:
> On Sun, 2012-05-27 at 16:23 +0200, Kay Sievers wrote:
> > On Sat, May 26, 2012 at 1:11 PM, Anton Vorontsov <anton.vorontsov@xxxxxxxxxx> wrote:
>
> > > So, starting from this patch every kmsg_dump user is getting the
> > > binary stuff, which is barely usable, and breaks a longstanding
> > > user-visible ABIs (e.g. mtdoops, oops dumping into nvram on PowerPC,
> > > and ramoops of course).
> >
> > These cases export their own format, it's just that the dump routines
> > could copy the buffer in only two steps (beginning and end of the ring
> > buffer), while in the future their code would need an update to copy
> > it record for record now. The exported format in the dump does not
> > necessarily need to change.
>
> Here is an untested patch, which should restore the old plain text
> export format of the kmsg buffer. I adds an iterator to the dumper
> routine, which can be used by the dumper to properly copy the data out
> of the kmsg record buffer. All current users are converted in the same
> patch.
>
> Any feedback/help in testing/updating and getting this thing into a
> mergeable state would be greatly appreciated.
>
> There are two versions of the iterator:
> kmsg_dump_get_line() starts with the oldest records. With the next call,
> the iterator retrieves one line after the other. Useful for cases like
> printing to a console or any other stream device.
>
> kmsg_dump_get_buffer() fills a buffer with as many of the youngest
> records as fit into it. With the next call, the iterator retrieves the
> next block of older messages. Useful to dump the entire buffer with one
> shot, or chunk the data into blocks and store them, with the youngest
> messages being the most important, retrieved first.
>
> Unlike the old logic, there are no stale pointers handed out to the
> dumper, if case things get overwritten while a dump is in progress,
> lines are not truncated or overwritten.

As no one seems to have responded, care to resend this with a
signed-off-by so I can queue it up for 3.6? If people complain, it can
still go to 3.5, but given that no one is saying anything, I guess no
one cares...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/