How not to write kernel messages

August 11, 2012

Suppose that you reboot your Ubuntu 12.04 Linux machine and see, among the kernel boot messages, the following:

Yama: becoming mindful.

Perhaps you've heard something about Yama and would like to understand what this means, perhaps you're looking for boot anomalies in general because of an odd problem you're having, or even perhaps you'd just like to understand your kernel's boot sequence. Is this message helpful?

Of course not. For most people this is completely opaque and simply not a useful message. Even if you've got some idea of what Yama is, the best you can do is to take a guess at what this message probably means. A much better version of this message would be something like 'Yama LSM initializing', and an even better version would change the code so that it only appears after the Yama LSM actually is initialized.

(Printing this message early on is probably excusable; at least in the current Linux kernel, the Yama LSM panics the system if it can't complete the remaining initialization. I assume that the registration functions it calls are not supposed to fail, even though they can return errors.)

Linux is far from the only Unix to do this, but for various reasons the Linux kernel has taken it to new heights (or depths). Quite a few kernel messages are not written for outside people, and in fact they're often not even written for general kernel programmers; they're pretty much written for the people who are working on the particular subsystem, the sort of people who know off the top of their head what Yama is and what an in-joke message like 'Yama: becoming mindful' actually means.

I'm not advocating for a totally buttoned down style of messages and sometimes you really do need debugging messages that require so much domain expertise that there's no point in making them comprehensible to outsiders. But most of the time kernel messages don't have to be anywhere near as obscure as they are.

(I expect that this is also the kind of thing that you generally can't fix by submitting a patch, because a patch to make a kernel message 'more boring' is highly likely to be politically explosive. Changing this needs to come from a cultural shift and internal pressure, not attempts from outsiders.)

Written on 11 August 2012.
« Learning something from not testing jQuery 1.8's beta releases
The CPython bytecode difference between iteration and looping »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sat Aug 11 00:42:32 2012
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.