Re: [RFC PATCH] cmdline: Hide "debug" from /proc/cmdline

Andy Lutomirski
2014-04-04T18:58:10Z

On Fri, Apr 4, 2014 at 11:32 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Fri, Apr 4, 2014 at 11:21 AM, Andy Lutomirski <luto@amacapital.net> wrote:
>>
>> The other thing I've used /dev/kmsg for is to shove a "I'm starting
>> something now" message in. This is only really necessary because the
>> current kernel log timestamps are unusable crap. (We could fix that,
>> hint hint.)
>
> I'd actually love to fix that, but I disagree with the "we could fix
> it". There are tons of people who know how to parse them (admittedly
> often only to ignore them), so changing the format is not likely to
> work.

What would break if we used CLOCK_BOOTTIME or CLOCK_MONOTONIC? It's
currently sched_clock, which is measured in seconds but otherwise
seems to behave rather unpredictably. We could keep exactly the same
format, but just use numbers measured in actual seconds instead of in
"seconds, but not really".

There are also log message metadata fields now; we could stick more
than one timestamp in there, and existing tools either won't see them
at all (if they use klogctl) or they already know how to ignore
unknown fields (/dev/kmsg).

For example, instead of logging:

[12345.67890] You wish you know what 12345 meant
DEVICE=blah

we could log:

[12345.67890] Hah! CLOCK_BOOTTIME says 12345.67890
DEVICE=blah
CLOCK_REALTIME=89173929281.171273

It would be really neat if we even went back and edited the queued up
messages once we have a clocksource. Userspace isn't running yet, so
it can't be surprised. We just won't show CLOCK_REALTIME at all until
someone sets the clock or we've read the RTC. Interested users still
have CLOCK_BOOTTIME.

>
> The good news is that "dmesg -H" does help if you're human. While at
> the same time being an example of that very "there are tools that know
> about the current horrid format" issue.. D'oh.
>

I admit I have no idea wtf causes this lovely excerpt from dmesg -H:

[ +26.385160] systemd-readahead[629]: Failed to rename readahead file: Permissio
[Apr 3 20:50] TCP: lp registered

I assume it's because dmesg -H decides that it can't handle old
timestamps. I don't know how it does with recent ones, though.

--Andy