public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] make loglevels in init/main.c a little more sane.
@ 2005-01-22 22:11 Jesper Juhl
  2005-08-22  5:17 ` Coywolf Qi Hunt
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Juhl @ 2005-01-22 22:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton


This patch modifies a few of the printk() loglevels used in init/main.c in 
an attempt to make them a bit more appropriate.

The default loglevel is KERN_WARNING, but a few printk's without explicit 
loglevel are not (in my oppinion) warnings, so add proper warning levels - 
for instance; telling the user how many CPU's were brought up is hardly a 
warning, make it KERN_INFO instead. The initial printing of linux_banner 
is not a warning condition, I'd say it's more of a NOTICE or even INFO 
condition - I've made it KERN_NOTICE just as the printing of the kernel 
command line. A few printk's without explicit loglevel do match the 
default one, but I've made them explicit (the default could change in the 
future, and if it does then explicitly setting the proper loglevel is a 
nice thing).
Please consider applying.

Patch compiles and boots fine on my box.


Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>

diff -up linux-2.6.11-rc2-orig/init/main.c linux-2.6.11-rc2/init/main.c
--- linux-2.6.11-rc2-orig/init/main.c	2005-01-22 22:00:02.000000000 +0100
+++ linux-2.6.11-rc2/init/main.c	2005-01-22 22:45:23.000000000 +0100
@@ -347,7 +347,7 @@ static void __init smp_init(void)
 	}
 
 	/* Any cleanup work */
-	printk("Brought up %ld CPUs\n", (long)num_online_cpus());
+	printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
 	smp_cpus_done(max_cpus);
 #if 0
 	/* Get other processors into their bootup holding patterns. */
@@ -428,6 +428,7 @@ asmlinkage void __init start_kernel(void
  */
 	lock_kernel();
 	page_address_init();
+	printk(KERN_NOTICE);
 	printk(linux_banner);
 	setup_arch(&command_line);
 	setup_per_cpu_areas();
@@ -451,7 +452,7 @@ asmlinkage void __init start_kernel(void
 	preempt_disable();
 	build_all_zonelists();
 	page_alloc_init();
-	printk("Kernel command line: %s\n", saved_command_line);
+	printk(KERN_NOTICE "Kernel command line: %s\n", saved_command_line);
 	parse_early_param();
 	parse_args("Booting kernel", command_line, __start___param,
 		   __stop___param - __start___param,
@@ -558,7 +559,7 @@ static void __init do_initcalls(void)
 			local_irq_enable();
 		}
 		if (msg) {
-			printk("error in initcall at 0x%p: "
+			printk(KERN_WARNING "error in initcall at 0x%p: "
 				"returned with %s\n", *call, msg);
 		}
 	}
@@ -677,7 +678,7 @@ static int init(void * unused)
 	numa_default_policy();
 
 	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
-		printk("Warning: unable to open an initial console.\n");
+		printk(KERN_WARNING "Warning: unable to open an initial console.\n");
 
 	(void) sys_dup(0);
 	(void) sys_dup(0);




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] make loglevels in init/main.c a little more sane.
  2005-01-22 22:11 [PATCH] make loglevels in init/main.c a little more sane Jesper Juhl
@ 2005-08-22  5:17 ` Coywolf Qi Hunt
  2005-08-22  5:41   ` Coywolf Qi Hunt
  0 siblings, 1 reply; 4+ messages in thread
From: Coywolf Qi Hunt @ 2005-08-22  5:17 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, Andrew Morton

On 1/23/05, Jesper Juhl <juhl-lkml@dif.dk> wrote:
> 
> This patch modifies a few of the printk() loglevels used in init/main.c in
> an attempt to make them a bit more appropriate.
> 
> The default loglevel is KERN_WARNING, but a few printk's without explicit
> loglevel are not (in my oppinion) warnings, so add proper warning levels -
> for instance; telling the user how many CPU's were brought up is hardly a
> warning, make it KERN_INFO instead. The initial printing of linux_banner
> is not a warning condition, I'd say it's more of a NOTICE or even INFO
> condition - I've made it KERN_NOTICE just as the printing of the kernel
> command line. A few printk's without explicit loglevel do match the
> default one, but I've made them explicit (the default could change in the
> future, and if it does then explicitly setting the proper loglevel is a
> nice thing).
> Please consider applying.
> 
> Patch compiles and boots fine on my box.
> 
> 
> Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
> 
> diff -up linux-2.6.11-rc2-orig/init/main.c linux-2.6.11-rc2/init/main.c
> --- linux-2.6.11-rc2-orig/init/main.c   2005-01-22 22:00:02.000000000 +0100
> +++ linux-2.6.11-rc2/init/main.c        2005-01-22 22:45:23.000000000 +0100
> @@ -347,7 +347,7 @@ static void __init smp_init(void)
>         }
> 
>         /* Any cleanup work */
> -       printk("Brought up %ld CPUs\n", (long)num_online_cpus());
> +       printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
>         smp_cpus_done(max_cpus);
>  #if 0
>         /* Get other processors into their bootup holding patterns. */
> @@ -428,6 +428,7 @@ asmlinkage void __init start_kernel(void
>   */
>         lock_kernel();
>         page_address_init();
> +       printk(KERN_NOTICE);
>         printk(linux_banner);

Why not merge it to the same line?

>         setup_arch(&command_line);
>         setup_per_cpu_areas();

-- 
Coywolf Qi Hunt
http://ahbl.org/~coywolf/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] make loglevels in init/main.c a little more sane.
  2005-08-22  5:17 ` Coywolf Qi Hunt
@ 2005-08-22  5:41   ` Coywolf Qi Hunt
  2005-08-22 22:49     ` Jesper Juhl
  0 siblings, 1 reply; 4+ messages in thread
From: Coywolf Qi Hunt @ 2005-08-22  5:41 UTC (permalink / raw)
  To: Coywolf Qi Hunt; +Cc: Jesper Juhl, linux-kernel, Andrew Morton

On Mon, Aug 22, 2005 at 01:17:59PM +0800, Coywolf Qi Hunt wrote:
> On 1/23/05, Jesper Juhl <juhl-lkml@dif.dk> wrote:
> > 
> > This patch modifies a few of the printk() loglevels used in init/main.c in
> > an attempt to make them a bit more appropriate.
> > 
> > The default loglevel is KERN_WARNING, but a few printk's without explicit
> > loglevel are not (in my oppinion) warnings, so add proper warning levels -
> > for instance; telling the user how many CPU's were brought up is hardly a
> > warning, make it KERN_INFO instead. The initial printing of linux_banner
> > is not a warning condition, I'd say it's more of a NOTICE or even INFO
> > condition - I've made it KERN_NOTICE just as the printing of the kernel
> > command line. A few printk's without explicit loglevel do match the
> > default one, but I've made them explicit (the default could change in the
> > future, and if it does then explicitly setting the proper loglevel is a
> > nice thing).
> > Please consider applying.
> > 
> > Patch compiles and boots fine on my box.
> > 
> > 
> > Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
> > 
> > diff -up linux-2.6.11-rc2-orig/init/main.c linux-2.6.11-rc2/init/main.c
> > --- linux-2.6.11-rc2-orig/init/main.c   2005-01-22 22:00:02.000000000 +0100
> > +++ linux-2.6.11-rc2/init/main.c        2005-01-22 22:45:23.000000000 +0100
> > @@ -347,7 +347,7 @@ static void __init smp_init(void)
> >         }
> > 
> >         /* Any cleanup work */
> > -       printk("Brought up %ld CPUs\n", (long)num_online_cpus());
> > +       printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
> >         smp_cpus_done(max_cpus);
> >  #if 0
> >         /* Get other processors into their bootup holding patterns. */
> > @@ -428,6 +428,7 @@ asmlinkage void __init start_kernel(void
> >   */
> >         lock_kernel();
> >         page_address_init();
> > +       printk(KERN_NOTICE);
> >         printk(linux_banner);
> 
> Why not merge it to the same line?
> 
> >         setup_arch(&command_line);
> >         setup_per_cpu_areas();

Hi,

I'm not sure if this is cleaner. The original 2-line implementation seems
convenient. All up to you. 

	Coywolf

Signed-off-by: Coywolf Qi Hunt <qiyong@fc-cn.com>

--- 2.6.13-rc6-mm1-cy/init/main.c~printk-linux_banner-cleanup	2005-08-22 08:09:47.000000000 +0800
+++ 2.6.13-rc6-mm1-cy/init/main.c	2005-08-22 13:29:48.000000000 +0800
@@ -450,8 +450,7 @@ asmlinkage void __init start_kernel(void
  */
 	lock_kernel();
 	page_address_init();
-	printk(KERN_NOTICE);
-	printk(linux_banner);
+	printk(KERN_NOTICE "%s", linux_banner);
 	setup_arch(&command_line);
 	setup_per_cpu_areas();
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] make loglevels in init/main.c a little more sane.
  2005-08-22  5:41   ` Coywolf Qi Hunt
@ 2005-08-22 22:49     ` Jesper Juhl
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2005-08-22 22:49 UTC (permalink / raw)
  To: Coywolf Qi Hunt; +Cc: Coywolf Qi Hunt, Jesper Juhl, linux-kernel, Andrew Morton

On 8/22/05, Coywolf Qi Hunt <qiyong@fc-cn.com> wrote:
> On Mon, Aug 22, 2005 at 01:17:59PM +0800, Coywolf Qi Hunt wrote:
> > On 1/23/05, Jesper Juhl <juhl-lkml@dif.dk> wrote:
> > >
[snip]
> > > +       printk(KERN_NOTICE);
> > >         printk(linux_banner);
> >
> > Why not merge it to the same line?
> >

No reason really.

[snip]
> 
> I'm not sure if this is cleaner. The original 2-line implementation seems
> convenient. All up to you.
> 
Either way is fine by me.

-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-08-22 22:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-22 22:11 [PATCH] make loglevels in init/main.c a little more sane Jesper Juhl
2005-08-22  5:17 ` Coywolf Qi Hunt
2005-08-22  5:41   ` Coywolf Qi Hunt
2005-08-22 22:49     ` Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox