Re: [RFC] New kernel-message logging API

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Vegard Nossum <vegard.nossum@...>
Cc: LKML <linux-kernel@...>, holzheu <holzheu@...>, Joe Perches <joe@...>, Rob Landley <rob@...>, Dick Streefland <dick.streefland@...>
Date: Tuesday, September 25, 2007 - 1:24 pm

On 9/25/07, Vegard Nossum <vegard.nossum@gmail.com> wrote:

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.


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).


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.


Thanks for your interest in the idea.

-- 
Miguel Ojeda
http://maxextreme.googlepages.com/index.htm
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] New kernel-message logging API, Vegard Nossum, (Sat Sep 22, 3:27 pm)
Re: [RFC] New kernel-message logging API, Jesse Barnes, (Mon Sep 24, 2:26 pm)
Re: [RFC] New kernel-message logging API, Michael Holzheu, (Mon Sep 24, 5:22 am)
Re: [RFC] New kernel-message logging API, Joe Perches, (Mon Sep 24, 11:19 am)
Re: [RFC] New kernel-message logging API, Michael Holzheu, (Tue Sep 25, 4:57 am)
Re: [RFC] New kernel-message logging API, Rob Landley, (Mon Sep 24, 7:51 pm)
Re: [RFC] New kernel-message logging API, Joe Perches, (Mon Sep 24, 8:10 pm)
Re: [RFC] New kernel-message logging API, Rob Landley, (Mon Sep 24, 9:46 pm)
Re: [RFC] New kernel-message logging API, Vegard Nossum, (Mon Sep 24, 12:43 pm)
Re: [RFC] New kernel-message logging API, Joe Perches, (Mon Sep 24, 1:00 pm)
Re: [RFC] New kernel-message logging API, Vegard Nossum, (Mon Sep 24, 4:37 pm)
Re: [RFC] New kernel-message logging API, Rob Landley, (Mon Sep 24, 9:18 pm)
Re: [RFC] New kernel-message logging API, Rob Landley, (Sun Sep 23, 4:05 pm)
Re: [RFC] New kernel-message logging API, Miguel Ojeda, (Sat Sep 22, 9:05 pm)
Re: [RFC] New kernel-message logging API, Vegard Nossum, (Tue Sep 25, 1:27 am)
Re: [RFC] New kernel-message logging API, Miguel Ojeda, (Tue Sep 25, 1:24 pm)
Re: [RFC] New kernel-message logging API, Joe Perches, (Sat Sep 22, 8:13 pm)
Re: [RFC] New kernel-message logging API, Vegard Nossum, (Sun Sep 23, 4:39 am)
Re: [RFC] New kernel-message logging API, Joe Perches, (Sun Sep 23, 3:25 pm)
Re: [RFC] New kernel-message logging API, Jan Engelhardt, (Sun Sep 23, 4:45 am)
Re: [RFC] New kernel-message logging API, Joe Perches, (Sun Sep 23, 3:23 pm)
Re: [RFC] New kernel-message logging API, Vegard Nossum, (Sun Sep 23, 5:20 am)
Re: [RFC] New kernel-message logging API, Jan Engelhardt, (Sun Sep 23, 5:38 am)
Re: [RFC] New kernel-message logging API, Kyle Moffett, (Sat Sep 22, 8:40 pm)
Re: [RFC] New kernel-message logging API, Joe Perches, (Sat Sep 22, 8:47 pm)
Re: [RFC] New kernel-message logging API, Kyle Moffett, (Sat Sep 22, 11:43 pm)