From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Joe Perches <joe@perches.com>, Huang Ying <ying.huang@intel.com>
Cc: William Douglas <william.r.douglas@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Printk mulitple line message support
Date: Mon, 14 Nov 2011 19:20:26 +0100 [thread overview]
Message-ID: <20111114192026.73afb5b8@neptune.home> (raw)
In-Reply-To: <1321281640.2004.6.camel@Joe-Laptop>
On Mon, 14 November 2011 Joe Perches <joe@perches.com> wrote:
> On Mon, 2011-11-14 at 14:58 +0800, Huang Ying wrote:
> > Hi,
> >
> > In most cases, printk only guarantees messages from different printk
> > calling will not be interleaved between each other. But many printk
> > users uses multiple line to form a complete message and call printk
> > for each line. So the following situation is possible for two printk
> > users running on two CPUs.
> >
> > line 1 of message from printk user1
> > line 1 of message from printk user2
> > line 2 of message from printk user1
> > line 2 of message from printk user2
> >
> > This makes kernel log hard to read. One possible solution to this
> > issue is to give a sequence number (or ID) to each complete message.
> > So the above lines will be:
> >
> > {1}line 1 of message from printk user1
> > {2}line 1 of message from printk user2
> > {1}line 2 of message from printk user1
> > {2}line 2 of message from printk user2
> >
> > Then some simple script can be used to group lines together according
> > to sequence number in lines.
> >
> > What do you think about that?
>
> This makes the typical multi-part but non-interleaved
> output difficult to read.
>
> How about determining if there is interleaving and
> emitting sequence # only in those cases?
>
> Perhaps test the atomic for the last sequence #.
Wouldn't another option be to let printk() handle '\n' in messages
so the multi-line messages could be done with a single call to printk.
Those messages could contain optional severity information after the
linefeed (if none given, the one of previous line would be repeated
internally by printk).
This way consumers of printk (and all variations of it like dev_err)
would all benefit without need to redefine them for multi-line use.
Bruno
next prev parent reply other threads:[~2011-11-14 18:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-14 6:58 Printk mulitple line message support Huang Ying
2011-11-14 14:40 ` Joe Perches
2011-11-14 18:20 ` Bruno Prémont [this message]
2011-11-15 0:18 ` Joe Perches
2011-11-15 0:58 ` Huang Ying
2011-11-15 0:50 ` Huang Ying
2011-11-15 1:18 ` Joe Perches
2011-11-15 1:52 ` Huang Ying
2011-11-15 2:30 ` Joe Perches
2011-11-15 2:59 ` Huang Ying
2011-11-15 3:41 ` Joe Perches
2011-11-16 0:43 ` Huang Ying
2011-11-16 0:45 ` Huang Ying
2011-11-16 0:54 ` Joe Perches
2011-11-16 0:29 ` Valdis.Kletnieks
2011-11-16 0:34 ` Joe Perches
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=20111114192026.73afb5b8@neptune.home \
--to=bonbons@linux-vserver.org \
--cc=akpm@linux-foundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=william.r.douglas@gmail.com \
--cc=ying.huang@intel.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