Re: [PATCH RESEND 1/3] printk: convert byte-buffer to variable-lengthrecord buffer

From: Kay Sievers
Date: Tue May 29 2012 - 13:22:34 EST


On Tue, May 29, 2012 at 7:11 PM, Luck, Tony <tony.luck@xxxxxxxxx> wrote:
> +/*
> + * Fill the provided buffer with as many of the the *youngest* kmsg records
> + * that fit into it. Repeated calls will fill the buffer with the next block
> + * of older records, not including the former ones. A return value of FALSE
> + * indicate that all records are read, including the oldest one.
> + */
>
> I confess to not reading all of this ... but does this handle the pstore/OOPS
> case? We'll use this call to pull as many records as will fit in the pstore
> error record ... but almost certainly won't pull all of the console log, so
> we won't see the FALSE return.

The loop in pstore gets the newest messages first, then another chunk
of the older messages with every call; pstore stops to iterate when
the defined limit it wants to store is reached, or when no messages
are available anymore.

> The system keeps on running.
>
> Now another OOPS happens and pstore wants to grab the new "youngest" records,
> it doesn't want to continue stepping to older records from the place it got
> to on the first OOPS. ÂWill that work?

A new oops will init the iterator again, so it will start at the end
with the new messages that happened in the meantime.

The iterator is only valid while used from dump(), it will return an
error if used outside of it.

The logic *should* work; at least it should be easy to make it work if
it doesn't. :)

Kay
--
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/