mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Tim Hockin" <thockin@hockin.org>
To: schwidefsky@de.ibm.com
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	lf_kernel_messages@lists.linux-foundation.org,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Michael Holzheu" <holzheu@de.ibm.com>,
	"Gerrit Huizenga" <gh@us.ibm.com>,
	"Greg Kroah-Hartman" <gregkh@suse.de>,
	"Randy Dunlap" <randy.dunlap@oracle.com>,
	"Jan Kara" <jack@suse.cz>, "Pavel Machek" <pavel@ucw.cz>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Joe Perches" <joe@perches.com>,
	"Jochen Voß" <jochen.voss@googlemail.com>,
	"Kunai Takashi" <kunai@linux-foundation.jp>,
	"Tim Bird" <tim.bird@am.sony.com>
Subject: Re: [patch 1/3] kmsg: Kernel message catalog macros.
Date: Thu, 14 Aug 2008 11:50:12 -0700	[thread overview]
Message-ID: <b3ece790808141150s3770531bsc88ec387e0f840d3@mail.gmail.com> (raw)
In-Reply-To: <1218733457.2651.11.camel@localhost>

On Thu, Aug 14, 2008 at 10:04 AM, Martin Schwidefsky
<schwidefsky@de.ibm.com> wrote:

>> I don't care for the magic file-global KMSG_COMPONENT. It just feels
>> wrong. In most cases, I want the prefix to be hierarchical. For example,
>> rather than "tg3" I want "net.tg3" or "netdev:tg3" or something.
>
> But what is the alternative to the #define to specify the base name of
> the message tag? KBUILD_MODNAME has been proposed but I don't think this
> is a good idea since I want the message tags to be independent of the
> code structure.

We had talked internally about something like this:

  globally:

    // this is the actual implementation
    extern void send_kmsg(int level, const char *fmt, ...);

    // this is a convenience wrapper, maybe not needed as they get combinatoric
    #define kmsg_err(fmt, ...) \
    	send_kmsg(KERN_ERROR, fmt, ##__VA_ARGS__)

  inside a subsystem-specific header:

    #define mysubsys_kmsg_err(fmt, ...) \
    	kmsg_err("mysubsys:" fmt "\n", ##__VA_ARGS__)

  inside each subsystem-driver:

    #define mydriver_kmsg_err(fmt, ...) \
    	mysubsys_kmsg_err("mydriver:" fmt, ##__VA_ARGS__)

  then the driver just calls:

    mydriver_kmsg_err("something happened");

  and you get, at the bottom:

    printk(KERN_ERROR "mysubsy:mydriver:something happened\n");

I'm not sure how your ID number fits in there, propbably

    printk(KERN_ERROR "mysubsy:mydriver.%d something happened\n", id);

That way, the hierarchy is defined by the meaningful hierarchy of
subsystems and busses and drivers.  Subsystems which have device structs
can add them into the mix (netdev, ATA, etc).  The core infrastructure
stays small, while providing driver and subsys maintainers the flexibility
to define their own event hierarchies.

>> Further, We want to make a clearer denotation between "just another
>> printk()" and these things, which are really "important events". Maybe a
>> global prefix that makes it easy to seperate them out? Or a parallel
>> "event" interface that logs to printk() and a netlink socket?
>
> Well the kmsg macros distinguish between id==0 and id>0 messages. For a
> id==0 message there is no documentation required and the kmsg prefix
> will be just the KMSG_COMPONENT. You could consider that to be "just
> another printk". For id>0 the kmsg macros will create the tuppel
> KMSG_COMPONENT.ID so you already can separate "normal" and "important"
> prinkts.

That works, I suppose.  I'd still advocate for a netlink-style conduit
(maybe with buffering?) for "important event" kmsgs, separate from plain
old printk.

I'd also advocate that maybe we should go a bit further with the
structure, by providing a soft-structured set of key-value pairs.  I'm not
100% on the details, but something like:

    printk(KERN_ERROR
    	"mysubsy:mydriver.%d something happened -- pid=%d status=0x%04x\n",
    	id, pid, status);

Where everything after "--" (or some other delimiter) is a key=value.

>> What I want to see is the elevation of these call-sites from "it's just a
>> printk()" to "it's a report-worthy event and part of our user<->kernel
>> API".  I want people to add them when it's appropriate and then not change
>> the strings later.  I don't care if, in the end, they are structured
>> strings.  I do care if I have to run dozens of regexes against thousands
>> of log-lines on thousands of systems.

> Yes, and this has already happened with the s390 device driver messages.
> With the conversion to kmsg our developers removed a lot of crud from
> the code, this alone makes it worthwhile.

Do you see *every* printk() becoming a kmsg?  Just printk() in drivers?
Or just some hand-chosen printk()s ?

Tim

  reply	other threads:[~2008-08-14 18:50 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30 16:56 [patch 0/3] [RFC] kmsg macros and script, take x+1 Martin Schwidefsky
2008-07-30 16:56 ` [patch 1/3] kmsg: Kernel message catalog macros Martin Schwidefsky
2008-07-30 19:39   ` Greg KH
2008-07-31  8:35     ` Martin Schwidefsky
2008-07-30 22:02   ` Kay Sievers
2008-07-30 22:04     ` Greg KH
2008-07-31  9:10       ` Martin Schwidefsky
2008-08-05 22:31         ` Greg KH
2008-08-06  8:35           ` Martin Schwidefsky
2008-08-06 20:07             ` Greg KH
2008-08-07  8:31               ` Martin Schwidefsky
2008-08-07 15:59                 ` Joe Perches
2008-08-10  0:08                   ` Martin Schwidefsky
2008-08-16 19:36                     ` Joe Perches
2008-08-17 17:27                       ` Martin Schwidefsky
2008-08-07 17:01                 ` Greg KH
2008-08-10  0:03                   ` Martin Schwidefsky
2008-08-11 10:54                     ` Jan Kara
2008-07-31  8:36     ` Martin Schwidefsky
2008-08-13  0:35   ` Tim Hockin
2008-08-14 17:04     ` Martin Schwidefsky
2008-08-14 18:50       ` Tim Hockin [this message]
2008-08-15  3:08         ` Joe Perches
2008-08-15  3:44           ` Greg KH
2008-08-15  5:33             ` Tim Hockin
2008-08-15 11:21               ` Jan Blunck
2008-08-15 15:39                 ` Tim Hockin
2008-08-18  9:23                   ` Pavel Machek
2008-08-18 10:39                     ` Jan Kara
2008-08-18 17:51                     ` Tim Hockin
2008-08-15 16:03               ` Greg KH
2008-08-15 17:03                 ` Tim Hockin
2008-08-16 18:06                   ` Martin Schwidefsky
2008-08-13  4:33   ` Rusty Russell
2008-08-13  7:04     ` Tim Hockin
2008-08-13  7:13       ` Pavel Machek
2008-08-13 14:50         ` Tim Hockin
2008-08-14  1:53       ` Rusty Russell
2008-08-14 15:40         ` Tim Hockin
2008-08-14 17:11           ` Martin Schwidefsky
2008-08-14 17:07     ` Martin Schwidefsky
2008-08-14 23:22       ` Rusty Russell
2008-08-16 17:49         ` Martin Schwidefsky
2008-08-16 20:40           ` Tim Hockin
2008-08-17  3:39             ` Rick Troth
2008-08-17  5:11             ` Rusty Russell
2008-08-17 17:33               ` Martin Schwidefsky
2008-08-17 17:28             ` Martin Schwidefsky
2008-08-17 17:31               ` Tim Hockin
2008-08-15 20:05     ` Rick Troth
2008-08-16 17:45       ` Martin Schwidefsky
2008-08-25 15:56     ` Martin Schwidefsky
2008-08-26  1:38       ` Rusty Russell
2008-09-01 12:28         ` Martin Schwidefsky
2008-09-02 13:34           ` Rusty Russell
2008-09-02 14:16             ` Martin Schwidefsky
2008-07-30 16:56 ` [patch 2/3] kmsg: Kernel message catalog script Martin Schwidefsky
2008-07-31  6:40   ` KOSAKI Motohiro
2008-07-31 10:23   ` Takashi Nishiie
2008-08-01 11:39     ` Martin Schwidefsky
2008-07-30 16:56 ` [patch 3/3] kmsg: convert xpram messages to kmsg api Martin Schwidefsky
2008-07-30 19:43   ` Greg KH
2008-07-31  8:33     ` Martin Schwidefsky
2008-08-05 22:34       ` Greg KH
2008-08-06  8:46         ` Martin Schwidefsky
2008-08-06 20:11           ` Greg KH
2008-08-07  8:39             ` Martin Schwidefsky
2008-08-07 17:03               ` Greg KH
2008-08-04  6:48   ` Pavel Machek
2008-08-04  8:06     ` Martin Schwidefsky
     [not found] ` <20080804202614.GA29170@uranus.ravnborg.org>
2008-08-05  8:03   ` [patch 0/3] [RFC] kmsg macros and script, take x+1 Martin Schwidefsky
     [not found] <OF576C88F7.D38E7FE6-ONC12574B1.00547361-C12574B1.005502D2@de.ibm.com>
2008-09-01 12:30 ` [patch 1/3] kmsg: Kernel message catalog macros Martin Schwidefsky

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=b3ece790808141150s3770531bsc88ec387e0f840d3@mail.gmail.com \
    --to=thockin@hockin.org \
    --cc=akpm@linux-foundation.org \
    --cc=gh@us.ibm.com \
    --cc=gregkh@suse.de \
    --cc=holzheu@de.ibm.com \
    --cc=jack@suse.cz \
    --cc=jochen.voss@googlemail.com \
    --cc=joe@perches.com \
    --cc=kunai@linux-foundation.jp \
    --cc=lf_kernel_messages@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=randy.dunlap@oracle.com \
    --cc=sam@ravnborg.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tim.bird@am.sony.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®