lkml.org 
[lkml]   [2008]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC/PATCH] printk: detect incomplete lines
On Mon, May 12, 2008 at 1:56 PM, Pekka Enberg <penberg@cs.helsinki.fi> wrote:
> On Mon, May 12, 2008 at 2:49 PM, Vegard Nossum <vegard.nossum@gmail.com> wrote:
> > This printk() problem has been bugging me for a long time. Consider the
> > following code:
> >
> > diff --git a/init/main.c b/init/main.c
> > index ddada7a..777e02d 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -452,17 +452,38 @@ static void __init setup_command_line(char *command_line)
> > * gcc-3.4 accidentally inlines this function, so use noinline.
> > */
> >
> > +static void printk_thread(const char *msg, unsigned long wait)
> > +{
> > + int i = 0;
> > +
> > + while(true) {
> > + if (i == 0)
> > + printk(KERN_INFO "Here we go: ");
> > +
> > + printk("%s%s", msg, i < 7 ? ", " : "\n");
>
> You are supposed to use KERN_CONT here.

Uhm, no. KERN_CONT won't help at all, see include/linux/kernel.h:

/*
* Annotation for a "continued" line of log printout (only done after a
* line that had no enclosing \n). Only to be used by core/arch code
* during early bootup (a continued line is not SMP-safe otherwise).
*/
#define KERN_CONT ""

So even if I did, it would make no difference for the example :-)

Iirc, KERN_CONT is mostly an annotation for the checkpatch script to
suppress the warning about missing loglevel token.

(And let's face it, there are places in the kernel that have continued
lines even after early bootup.)

Vegard

--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036


\
 
 \ /
  Last update: 2008-05-12 14:03    [W:0.066 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site