From: "Miguel Ojeda" <maxextreme@gmail.com>
To: "Vegard Nossum" <vegard.nossum@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
holzheu <holzheu@linux.vnet.ibm.com>,
"Joe Perches" <joe@perches.com>, "Rob Landley" <rob@landley.net>,
"Dick Streefland" <dick.streefland@altium.nl>
Subject: Re: [RFC] New kernel-message logging API
Date: Tue, 25 Sep 2007 19:24:46 +0200 [thread overview]
Message-ID: <653402b90709251024k5ae2d120n93e3e00ee6ba0e21@mail.gmail.com> (raw)
In-Reply-To: <19f34abd0709242227n5ac1f7dp5b1589ceeb3e4c0e@mail.gmail.com>
On 9/25/07, Vegard Nossum <vegard.nossum@gmail.com> wrote:
> On 9/23/07, Miguel Ojeda <maxextreme@gmail.com> wrote:
> > Nice. I would suggest having some kind of standard way to show the
> > information on the screen/dmesg. I mean, instead of having plain lines
> > being written to the log, having something very short like:
>
> Thanks for the idea. Is this something you want to (manually) insert
> in each printk, or would it be passed like a parameter?
No parameters if possible: As you said, one or two #define's in the
beggining of the file can tell printk what to print as subsystem and
driver/...; and the reason (printk_xxx) could tell the loglevel. For
example: "detected", "registered" or "copyright" messages will have
always some low level priority; and "errors" or "alerts" high
priorities. This can help whenever selecting what loglevel priorities
to log, as all drivers will log most common messages in the same
loglevel.
So, with your change to printk_xxx, we can add real meaning to the
messages, and forget about selecting a priority for most common
messages. And that does not break your idea of writing printk_yyy,
being yyy all the priorities, as we will be able to use that functions
for uncommon kind of messages.
To clarify what I'm saying, here is an example:
#define PRINTK_SUBSYSTEM "video"
#define PRINTK_DRIVER "some123ag"
...
printk_copyright("Pretty Systems Inc. (C) <some@body.com>");
...
printk_detected("Some Pro 123ag VGA");
...
printk_registered("Framebuffer /dev/fb1");
...
if (really_weird_stuff_happened)
printk_emerg("Video card appears to be disconnected!");
As you see, each message will write to the correct priority. Even,
things like "printk_copyright" could have a macro like:
#define PRINTK_COPYRIGHT(who, year, email) printk_copyright(who " (C)
" year " <" email ">");
But I think that its going too far.
> For the subsystem part, it might be possible to #define a subsystem name at
> the beginning of each file and have printing functions automatically
> use this. But otherwise, I think the usefulness of this is perhaps a
> little low compared to the effort needed (ie. for this to be useful,
> each and every printk of the kernel would need to be changed). Also
Right... But in the long time, it can help a lot. For now, every
maintainer should add the #define line in each file and write the
reason while changing the function name (that is something we will
have to do anyway if you change printk).
> notice, even in your examples, that most subsystems/drivers already
> prefix their messages to identify the source. Perhaps a better effort
> spent would be to go through the ones that are missing this "source"
> prefix and fix them?
I would say 70% do it. Also, they just write the name of the
subsystem/driver, a ':' and then a non-standard string. I mean, most
of the messages are about a new detected device, an error encountered,
a registered/mounted device/link, the copyright, the authors, ... Some
of them say "registered XXX", others "XXX registered", other just say
"new XXX" or split the message in two lines, etc.
My point is: Most of the messages are inside five or six categories,
so if people is ready to change/improve printk() API, let's finish all
the duplication, as we usually do with code.
Also, I think it could help a lot in the future if we categorize the
messages by subsystem/driver and level/reason: then we could write
more useful tools for debugging, logging... We could "grep" it, or
select what we want to log, etc.
I'm sure this idea is maybe overwhelming at first, but I think that in
the future will help a lot. Linux is growing everyday more and more,
and if printk() is about to change, as soon as we introduce new
features, easier will be.
>
> Vegard
>
Thanks for your interest in the idea.
--
Miguel Ojeda
http://maxextreme.googlepages.com/index.htm
next prev parent reply other threads:[~2007-09-25 17:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-22 19:27 Vegard Nossum
2007-09-23 0:13 ` Joe Perches
2007-09-23 0:40 ` Kyle Moffett
2007-09-23 0:47 ` Joe Perches
2007-09-23 3:43 ` Kyle Moffett
2007-09-23 8:39 ` Vegard Nossum
2007-09-23 8:45 ` Jan Engelhardt
2007-09-23 9:20 ` Vegard Nossum
2007-09-23 9:38 ` Jan Engelhardt
2007-09-23 19:23 ` Joe Perches
2007-09-23 19:25 ` Joe Perches
2007-09-23 1:05 ` Miguel Ojeda
2007-09-25 5:27 ` Vegard Nossum
2007-09-25 17:24 ` Miguel Ojeda [this message]
2007-09-23 20:05 ` Rob Landley
2007-09-24 9:22 ` Michael Holzheu
2007-09-24 15:19 ` Joe Perches
2007-09-24 16:43 ` Vegard Nossum
2007-09-24 17:00 ` Joe Perches
2007-09-24 20:37 ` Vegard Nossum
2007-09-25 1:18 ` Rob Landley
2007-09-24 23:51 ` Rob Landley
2007-09-25 0:10 ` Joe Perches
2007-09-25 1:46 ` Rob Landley
2007-09-25 8:57 ` Michael Holzheu
2007-09-24 18:26 ` Jesse Barnes
2007-09-25 4:58 linux
2007-09-25 6:54 ` Joe Perches
2007-09-25 7:50 ` linux
2007-09-25 8:06 ` Vegard Nossum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=653402b90709251024k5ae2d120n93e3e00ee6ba0e21@mail.gmail.com \
--to=maxextreme@gmail.com \
--cc=dick.streefland@altium.nl \
--cc=holzheu@linux.vnet.ibm.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rob@landley.net \
--cc=vegard.nossum@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®