lkml.org 
[lkml]   [2011]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Printk mulitple line message support
From
Date
On Tue, 2011-11-15 at 02:20 +0800, Bruno Prémont wrote:
> 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.

Yes. That is another solution. But sometimes, it is just not so
convenient to do that. The printk users may have to allocate a big
buffer to hold all these lines. The solution here is for those users.

Best Regards,
Huang Ying


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-11-15 02:01    [W:0.053 / U:0.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site