Patchwork Maximum/default console log level for kconfig

login
register
about
Submitter Myles Watson
Date 2009-10-13 14:51:30
Message ID <2831fecf0910130751p5f867e25l1935629f9bcd27d3@mail.gmail.com>
Download mbox | patch
Permalink /patch/397/
State Accepted
Headers show

Comments

Myles Watson - 2009-10-13 14:51:30
On Mon, Oct 12, 2009 at 4:17 PM, Uwe Hermann <uwe@hermann-uwe.de> wrote:
> On Mon, Oct 12, 2009 at 02:09:03PM -0600, Myles Watson wrote:
>> >> > +config MAXIMUM_CONSOLE_LOGLEVEL_8
>> >> > +        bool "8: BIOS_SPEW"
>> BIOS_SPEW is 9, not 8.  Could you fix it?
>
> Hm, nope, I think all Config.lb files are wrong here, they should use 8.

> #define BIOS_DEBUG      7   /* debug-level messages                 */
> #define BIOS_SPEW       8   /* Way too many details                 */
>
> Using 9 has the same effect as using 8 I guess.
Nope.  Spew messages don't show up anymore.

LOGLEVEL = 8:

coreboot-2.3" Tue Oct 13 07:40:07 MDT 2009 starting...
Copying coreboot to RAM.
Jumping to image.

Check fallback/coreboot_ram
Stage: load fallback/coreboot_ram @ 1048576/106496 bytes, enter @ 100000
Stage: done loading.
Jumping to image.

coreboot-2.3 Tue Oct 13 07:40:07 MDT 2009 booting...

LOGLEVEL = 9:

coreboot-2.3" Tue Oct 13 07:43:57 MDT 2009 starting...
Copying coreboot to RAM.
Jumping to image.

Check CBFS header at fffeffe0
magic is 4f524243
Found CBFS header at fffeffe0
Check fallback/coreboot_ram
Stage: load fallback/coreboot_ram @ 1048576/106496 bytes, enter @ 100000
Stage: done loading.
Jumping to image.


Attached patch fixes it.

There's a strange mix of comparisons, which makes it harder to tell
what's going on.  There are also lots of functions that do these
checks.  Hopefully I didn't miss any.  I checked a few values with
console_debug.diff.

While I was fooling with it, I made Kconfig ensure that
MAXIMUM_CONSOLE_LOGLEVEL >= DEFAULT_CONSOLE_LOGLEVEL to minimize the
number of test cases I needed.

Signed-off-by: Myles Watson <mylesgw@gmail.com>

Thanks,
Myles
Stefan Reinauer - 2009-10-13 16:31:01
Myles Watson wrote:
> On Mon, Oct 12, 2009 at 4:17 PM, Uwe Hermann <uwe@hermann-uwe.de> wrote:
>   
>> On Mon, Oct 12, 2009 at 02:09:03PM -0600, Myles Watson wrote:
>>     
>>>>>> +config MAXIMUM_CONSOLE_LOGLEVEL_8
>>>>>> +        bool "8: BIOS_SPEW"
>>>>>>             
>>> BIOS_SPEW is 9, not 8.  Could you fix it?
>>>       
>> Hm, nope, I think all Config.lb files are wrong here, they should use 8.
>>     
>
>   
>> #define BIOS_DEBUG      7   /* debug-level messages                 */
>> #define BIOS_SPEW       8   /* Way too many details                 */
>>
>> Using 9 has the same effect as using 8 I guess.
>>     
> Nope.  Spew messages don't show up anymore.
>
>   
Maybe EMERG should be one and OFF should be 0?
Myles Watson - 2009-10-13 16:35:14
> -----Original Message-----
> From: Stefan Reinauer [mailto:stepan@coresystems.de]
> Sent: Tuesday, October 13, 2009 10:31 AM
> To: Myles Watson
> Cc: Uwe Hermann; coreboot@coreboot.org
> Subject: Re: [coreboot] [PATCH] Maximum/default console log level for
> kconfig
> 
> Myles Watson wrote:
> > On Mon, Oct 12, 2009 at 4:17 PM, Uwe Hermann <uwe@hermann-uwe.de> wrote:
> >
> >> On Mon, Oct 12, 2009 at 02:09:03PM -0600, Myles Watson wrote:
> >>
> >>>>>> +config MAXIMUM_CONSOLE_LOGLEVEL_8
> >>>>>> +        bool "8: BIOS_SPEW"
> >>>>>>
> >>> BIOS_SPEW is 9, not 8.  Could you fix it?
> >>>
> >> Hm, nope, I think all Config.lb files are wrong here, they should use
> 8.
> >>
> >
> >
> >> #define BIOS_DEBUG      7   /* debug-level messages                 */
> >> #define BIOS_SPEW       8   /* Way too many details                 */
> >>
> >> Using 9 has the same effect as using 8 I guess.
> >>
> > Nope.  Spew messages don't show up anymore.
> >
> >
> Maybe EMERG should be one and OFF should be 0?
That's fine too.  The actual values don't matter to me.  In some of the
comments in the code it says we don't allow anything lower than 1.

I just want SPEW to come out if I specify SPEW :)

Thanks,
Myles
Myles Watson - 2009-10-16 18:36:52
> On Mon, Oct 12, 2009 at 4:17 PM, Uwe Hermann <uwe@hermann-uwe.de> wrote:
> > On Mon, Oct 12, 2009 at 02:09:03PM -0600, Myles Watson wrote:
> >> >> > +config MAXIMUM_CONSOLE_LOGLEVEL_8
> >> >> > +        bool "8: BIOS_SPEW"
> >> BIOS_SPEW is 9, not 8.  Could you fix it?
> >
> > Hm, nope, I think all Config.lb files are wrong here, they should use 8.
> 
> > #define BIOS_DEBUG      7   /* debug-level messages                 */
> > #define BIOS_SPEW       8   /* Way too many details                 */
> >
> > Using 9 has the same effect as using 8 I guess.
> Nope.  Spew messages don't show up anymore.
...
> While I was fooling with it, I made Kconfig ensure that
> MAXIMUM_CONSOLE_LOGLEVEL >= DEFAULT_CONSOLE_LOGLEVEL to minimize the
> number of test cases I needed.
> 
> Signed-off-by: Myles Watson <mylesgw@gmail.com>
Ping.

I'd like to be able to say "Try Kconfig with SPEW", but it doesn’t work.

Thanks,
Myles
Stefan Reinauer - 2009-10-16 19:18:24
On Oct 16, 2009, at 20:36, "Myles Watson" <mylesgw@gmail.com> wrote:

>
>> On Mon, Oct 12, 2009 at 4:17 PM, Uwe Hermann <uwe@hermann-uwe.de>  
>> wrote:
>>> On Mon, Oct 12, 2009 at 02:09:03PM -0600, Myles Watson wrote:
>>>>>>> +config MAXIMUM_CONSOLE_LOGLEVEL_8
>>>>>>> +        bool "8: BIOS_SPEW"
>>>> BIOS_SPEW is 9, not 8.  Could you fix it?
>>>
>>> Hm, nope, I think all Config.lb files are wrong here, they should  
>>> use 8.
>>
>>> #define BIOS_DEBUG      7   /* debug-level  
>>> messages                 */
>>> #define BIOS_SPEW       8   /* Way too many  
>>> details                 */
>>>
>>> Using 9 has the same effect as using 8 I guess.
>> Nope.  Spew messages don't show up anymore.
> ...
>> While I was fooling with it, I made Kconfig ensure that
>> MAXIMUM_CONSOLE_LOGLEVEL >= DEFAULT_CONSOLE_LOGLEVEL to minimize the
>> number of test cases I needed.
>>
>> Signed-off-by: Myles Watson <mylesgw@gmail.com>
> Ping.
>
> I'd like to be able to say "Try Kconfig with SPEW", but it doesn’t w 
> ork.
>

Acked-by: Stefan Reinauer <stepan@coresystems.de>


> Thanks,
> Myles
>
>
> -- 
> coreboot mailing list: coreboot@coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot
>
Uwe Hermann - 2009-10-16 19:20:12
On Tue, Oct 13, 2009 at 08:51:30AM -0600, Myles Watson wrote:
> While I was fooling with it, I made Kconfig ensure that
> MAXIMUM_CONSOLE_LOGLEVEL >= DEFAULT_CONSOLE_LOGLEVEL to minimize the
> number of test cases I needed.
> 
> Signed-off-by: Myles Watson <mylesgw@gmail.com>

Untested, but looks good.

Acked-by: Uwe Hermann <uwe@hermann-uwe.de>


> Index: svn/src/console/Kconfig
> ===================================================================
> --- svn.orig/src/console/Kconfig
> +++ svn/src/console/Kconfig
> @@ -141,34 +141,54 @@ choice
>  
>  config DEFAULT_CONSOLE_LOGLEVEL_8
>          bool "8: SPEW"
> +	depends on (MAXIMUM_CONSOLE_LOGLEVEL >= 8)

The indentation in this file looks strange as the items didn't use TABs
so far, feel free to change them all to TABs in this or in an extra
commit.

Having DEFAULT_CONSOLE_LOGLEVEL depend on the MAXIMUM_CONSOLE_LOGLEVEL
is really nice!


Uwe.
Myles Watson - 2009-10-16 19:34:13
On Fri, Oct 16, 2009 at 1:20 PM, Uwe Hermann <uwe@hermann-uwe.de> wrote:

> On Tue, Oct 13, 2009 at 08:51:30AM -0600, Myles Watson wrote:
> > While I was fooling with it, I made Kconfig ensure that
> > MAXIMUM_CONSOLE_LOGLEVEL >= DEFAULT_CONSOLE_LOGLEVEL to minimize the
> > number of test cases I needed.
> >
> > Signed-off-by: Myles Watson <mylesgw@gmail.com>
>
> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
>


> Acked-by: Stefan Reinauer <stepan@coresystems.de>
>
Rev 4794.


> > Index: svn/src/console/Kconfig
> > ===================================================================
> > --- svn.orig/src/console/Kconfig
> > +++ svn/src/console/Kconfig
>
> The indentation in this file looks strange as the items didn't use TABs
> so far, feel free to change them all to TABs in this or in an extra
> commit.
>
Fixed.

Having DEFAULT_CONSOLE_LOGLEVEL depend on the MAXIMUM_CONSOLE_LOGLEVEL
> is really nice!
>
Thanks.  I wish I could have used >, but I couldn't make it work in the
depends clause.

I'd love to know how to do depends on (MAXIMUM_CONSOLE_LOGLEVEL > 4).

Thanks,
Myles

Patch

Index: svn/src/console/printk.c
===================================================================
--- svn.orig/src/console/printk.c
+++ svn/src/console/printk.c
@@ -37,9 +37,12 @@  int do_printk(int msg_level, const char 
 	}
 
 	spin_lock(&console_lock);
+	console_tx_byte('0'+msg_level);
+	console_tx_byte(':');
+	console_tx_byte(' ');
 
 	va_start(args, fmt);
-	i = vtxprintf(console_tx_byte, fmt, args);
+	i = 3 + vtxprintf(console_tx_byte, fmt, args);
 	va_end(args);
 
 	console_tx_flush();
Index: svn/src/arch/i386/lib/console_print.c
===================================================================
--- svn.orig/src/arch/i386/lib/console_print.c
+++ svn/src/arch/i386/lib/console_print.c
@@ -52,6 +52,9 @@  static void __console_tx_string(int logl
 {
 	if (ASM_CONSOLE_LOGLEVEL >= loglevel) {
 		unsigned char ch;
+		__console_tx_byte('0'+loglevel);
+		__console_tx_byte(':');
+		__console_tx_byte(' ');
 		while((ch = *str++) != '\0') {
 			__console_tx_byte(ch);
 		}
Index: svn/src/arch/i386/lib/console_printk.c
===================================================================
--- svn.orig/src/arch/i386/lib/console_printk.c
+++ svn/src/arch/i386/lib/console_printk.c
@@ -48,15 +48,15 @@  extern int do_printk(int msg_level, cons
 #define printk_spew(fmt, arg...)    do_printk(BIOS_EMERG   , "", ##arg)
 #endif
 
-#define print_emerg(STR)   printk_emerg  ("%s", (STR))
-#define print_alert(STR)   printk_alert  ("%s", (STR))
-#define print_crit(STR)    printk_crit   ("%s", (STR))
-#define print_err(STR)     printk_err    ("%s", (STR))
-#define print_warning(STR) printk_warning("%s", (STR))
-#define print_notice(STR)  printk_notice ("%s", (STR))
-#define print_info(STR)    printk_info   ("%s", (STR))
-#define print_debug(STR)   printk_debug  ("%s", (STR))
-#define print_spew(STR)    printk_spew   ("%s", (STR))
+#define print_emerg(STR)   printk_emerg  ("0: %s", (STR))
+#define print_alert(STR)   printk_alert  ("1: %s", (STR))
+#define print_crit(STR)    printk_crit   ("2: %s", (STR))
+#define print_err(STR)     printk_err    ("3: %s", (STR))
+#define print_warning(STR) printk_warning("4: %s", (STR))
+#define print_notice(STR)  printk_notice ("5: %s", (STR))
+#define print_info(STR)    printk_info   ("6: %s", (STR))
+#define print_debug(STR)   printk_debug  ("7: %s", (STR))
+#define print_spew(STR)    printk_spew   ("8: %s", (STR))
 
 #define print_emerg_char(CH)   printk_emerg  ("%c", (CH))
 #define print_alert_char(CH)   printk_alert  ("%c", (CH))
Index: svn/src/arch/i386/lib/printk_init.c
===================================================================
--- svn.orig/src/arch/i386/lib/printk_init.c
+++ svn/src/arch/i386/lib/printk_init.c
@@ -38,8 +38,12 @@  int do_printk(int msg_level, const char 
 		return 0;
 	}
 
+	console_tx_byte('0'+msg_level);
+	console_tx_byte(':');
+	console_tx_byte(' ');
+
 	va_start(args, fmt);
-	i = vtxprintf(console_tx_byte, fmt, args);
+	i = 3 + vtxprintf(console_tx_byte, fmt, args);
 	va_end(args);
 
 	return i;