[#5420] kernel boot-up info miss if boot args earlyprintk is not set

Document created by Aaronwu Employee on Sep 4, 2013
Version 1Show Document
  • View in full screen mode

[#5420] kernel boot-up info miss if boot args earlyprintk is not set

Submitted By: Mingquan Pan

Open Date

2009-08-05 21:04:25     Close Date

2009-08-14 00:06:04

Priority:

Medium     Assignee:

Robin Getz

Status:

Closed     Fixed In Release:

N/A

Found In Release:

N/A     Release:

Category:

N/A     Board:

N/A

Processor:

BF537     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:

Fixed

Uboot version or rev.:

    Toolchain version or rev.:

09r1-rc9

App binary format:

N/A     

Summary: kernel boot-up info miss if boot args earlyprintk is not set

Details:

 

some kernel boot-up info miss if kernel configured with CMDLINE_BOOL.

 

The startup would like:

 

## Booting kernel from Legacy Image at 02000000 ...^M

   Image Name:   Linux-2.6.28.10-ADI-2009R1-svn69^M

   Created:      2009-07-08   9:01:48 UTC^M

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)^M

   Data Size:    4722688 Bytes =  4.5 MB^M

   Load Address: 00001000^M

   Entry Point:  00196744^M

   Verifying Checksum ... OK^M

   Uncompressing Kernel Image ... OK^M

Starting Kernel at = 00196744^M

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)^M

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)^M

Memory available: 47736k/65536k RAM, (7468k init code, 1071k kernel code, 493k data, 1024k dma, 7744k reserved)^M

Calibrating delay loop... 997.37 BogoMIPS (lpj=1994752)^M

Security Framework initialized^M

Mount-cache hash table entries: 512^M

Blackfin Scratchpad data SRAM: 4 KB^M

Blackfin L1 Data A SRAM: 16 KB (15 KB free)^M

Blackfin L1 Data B SRAM: 16 KB (16 KB free)^M

Blackfin L1 Instruction SRAM: 48 KB (36 KB free)^M

net_namespace: 288 bytes^M

NET: Registered protocol family 16^M

Blackfin DMA Controller^M

stamp_init(): registering device resources^M

NET: Registered protocol family 2^M

...

 

The revision numbers info, etc would be omitted.

 

The passed revision: linux 6925   uclinux  8429

The failed revision: linux  6940  uclinux  8452

 

Follow-ups

 

--- Sonic Zhang                                              2009-08-07 01:52:20

If earlyprintk boot parameter is not set, earlyprintk console is not

initialized. But, shadow console always initialize at the very beginning, which

eats kernel output before default kernel uart console is ready.

 

If no console is initialized at the very beginning, kernel output stays in

printk buffer till default kernel uart console is ready.

 

 

--- Sonic Zhang                                              2009-08-07 02:20:22

Walkaround

 

Current solution is if EARLY_PRINTK is enabled in kernel, boot paramter

earlyprintk should always be set properly.

 

--- Mike Frysinger                                           2009-08-11 03:44:09

workarounds arent fixes.  the console should have all output replayed to it if

it wasnt an early console before.

 

--- Sonic Zhang                                              2009-08-11 03:49:49

No. the kernel doesn't work that way. kernel output are written into any current

consoles. Console except the first one only get kernel output after it registers

itself.

 

--- Sonic Zhang                                              2009-08-11 03:51:11

This bug is caused by Robin's hack of shadow console for blackfin debugging

only.

No other archs are affected.

 

--- Robin Getz                                               2009-08-11 10:42:48

It's not a hack. It's the solution that is going upstream - it has already been

accepted in -tip.

 

If a console is registered with it's CON_PRINTBUFFER set, it should get the

entire logbuf - that is how the kernel is suppose to work.

 

-Robin

 

 

--- Robin Getz                                               2009-08-11 13:42:56

This was caused by something I pushed upstream, and never committed (until now)

in our svn.

 

Should be fixed now.

 

-Robin

 

--- Robin Getz                                               2009-08-11 16:50:04

Marking as fixed.

 

--- Sonic Zhang                                              2009-08-12 00:03:19

Is this the expected output of your patch?

 

Starting Kernel at = 00186888

Linux version 2.6.28.10-ADI-2009R1-svn7155 (root@eight) (gcc version 4.1.2 (ADI

svn)) #39

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

Warning: limiting memory to 56MB due to hardware anomaly 05000263

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x00104730

  rodata    = 0x00104730-0x00155534

  bss       = 0x00156000-0x00167720

  data      = 0x00167720-0x00178000

    stack   = 0x00176000-0x00178000

  init      = 0x00178000-0x008c1000

  available = 0x008c1000-0x037ff000

  DMA Zone  = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Boot Mode: 0

Blackfin support (C) 2004-2009 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by http://blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 100 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

Data Cache Enabled for CPU0 (write-back)

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 14223

Kernel command line: root=/dev/mtdblock0 rw earlyprintk=serial,uart0,57600

console=ttyBFf

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 256 (order: 8, 1024 bytes)

Linux version 2.6.28.10-ADI-2009R1-svn7155 (root@eight) (gcc version 4.1.2 (ADI

svn)) #39

Linux version 2.6.28.10-ADI-2009R1-svn7155 (root@eight) (gcc version 4.1.2 (ADI

svn)) #39

bootconsole [early_shadow0] enabled

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

early printk enabled on early_BFuart0

Warning: limiting memory to 56MB due to hardware anomaly 05000263

Warning: limiting memory to 56MB due to hardware anomaly 05000263

Board Memory: 64MB

Board Memory: 64MB

Kernel Managed Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

Memory map:

  fixedcode = 0x00000400-0x00000490

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x00104730

  text      = 0x00001000-0x00104730

  rodata    = 0x00104730-0x00155534

  rodata    = 0x00104730-0x00155534

  bss       = 0x00156000-0x00167720

  bss       = 0x00156000-0x00167720

  data      = 0x00167720-0x00178000

  data      = 0x00167720-0x00178000

    stack   = 0x00176000-0x00178000

    stack   = 0x00176000-0x00178000

  init      = 0x00178000-0x008c1000

  init      = 0x00178000-0x008c1000

  available = 0x008c1000-0x037ff000

  available = 0x008c1000-0x037ff000

  DMA Zone  = 0x03f00000-0x04000000

  DMA Zone  = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Hardware Trace Active and Enabled

Boot Mode: 0

Boot Mode: 0

Blackfin support (C) 2004-2009 Analog Devices, Inc.

Blackfin support (C) 2004-2009 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.2

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by http://blackfin.uclinux.org/

Blackfin Linux support by http://blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 100 MHz System Clock

Processor Speed: 500 MHz core clock and 100 MHz System Clock

NOMPU: setting up cplb tables

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

Instruction Cache Enabled for CPU0

Data Cache Enabled for CPU0 (write-back)

Data Cache Enabled for CPU0 (write-back)

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 14223

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 14223

Kernel command line: root=/dev/mtdblock0 rw earlyprintk=serial,uart0,57600

console=ttyBFf

Kernel command line: root=/dev/mtdblock0 rw earlyprintk=serial,uart0,57600

console=ttyBFf

Configuring Blackfin Priority Driven Interrupts

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 256 (order: 8, 1024 bytes)

PID hash table entries: 256 (order: 8, 1024 bytes)

console [ttyBF0] enabled, bootconsole disabled

console [ttyBF0] enabled, bootconsole disabled

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory available: 47808k/65536k RAM, (7460k init code, 1037k kernel code, 463k

data, 102)

Calibrating delay loop... 995.32 BogoMIPS (lpj=1990656)

Security Framework initialized                                                

        

 

--- Sonic Zhang                                              2009-08-12 00:54:02

Hi Robin,

I don't think your last patch is a better solution. The only thing in

kernel/printk.c that need to be changed to fix this bug is to remove line 1344

"newcon->flags &= ~CON_PRINTBUFFER;".

 

 

--- Sonic Zhang                                              2009-08-12 01:50:33

Another solution is to give shadow console a CON_SHADOW flag. And don't

duplicate output if non shadow boot console exists. But, this loses boot output

as well if earlyprintk tty device is different from kernel console.

 

Index: kernel/printk.c

===================================================================

--- kernel/printk.c    (revision 7158)

+++ kernel/printk.c    (working copy)

@@ -1212,8 +1212,11 @@

             printk("boot [%s%d] ", bcon->name, bcon->index);

         printk(" -> real [%s%d]\n", newcon->name,

newcon->index);

         for_each_console(bcon)

-            unregister_console(bcon);

-        newcon->flags &= ~CON_PRINTBUFFER;

+            if (bcon->flags & CON_BOOT) {

+                unregister_console(bcon);

+                if (!(bcon->flags & CON_SHADOW))

+                    newcon->flags &= ~CON_PRINTBUFFER;

+            }

     } else {

         printk(KERN_INFO "%sconsole [%s%d] enabled\n",

             (newcon->flags & CON_BOOT) ? "boot" : "" ,

Index: include/linux/console.h

===================================================================

--- include/linux/console.h    (revision 7157)

+++ include/linux/console.h    (working copy)

@@ -92,6 +92,7 @@

#define CON_BOOT    (8)

#define CON_ANYTIME    (16) /* Safe to call when cpu is offline */

#define CON_BRL        (32) /* Used for a braille device */

+#define CON_SHADOW    (64) /* used for a buffer based virtual console */

 

struct console {

     char    name[16];

Index: arch/blackfin/kernel/shadow_console.c

===================================================================

--- arch/blackfin/kernel/shadow_console.c    (revision 7129)

+++ arch/blackfin/kernel/shadow_console.c    (working copy)

@@ -58,7 +58,7 @@

static __initdata struct console early_shadow_console = {

     .name = "early_shadow",

     .write = early_shadow_write,

-    .flags = CON_BOOT | CON_PRINTBUFFER,

+    .flags = CON_BOOT | CON_PRINTBUFFER | CON_SHADOW,

     .index = -1,

     .device = 0,

};

 

 

--- Sonic Zhang                                              2009-08-12 02:00:31

It is better to output info on all consoles rather than drop info on part of

them.

 

--- Mike Frysinger                                           2009-08-12 02:32:59

the whole point of Robin's work was to avoid duplicated output.  CON_SHADOW also

really wont fly as it doesnt fit into the common notions of consoles.

 

--- Robin Getz                                               2009-08-12 07:04:05

Sonic:

 

>I don't think your last patch is a better solution.

 

No - this is exactly the discussion we already had on lkml (with Ingo &

Andrew) - and the patch that was committed.

 

I thought we didn't revert other people's patches without a discussion first?

 

Please put things back the way you find them - which is the way things are in

tip, and the way that 2.6.31 will be. Your proposed change has already been

rejected by upstream.

 

-robin

 

--- Robin Getz                                               2009-08-12 09:44:38

The proper change -- is something like this.

 

If you don't want things printed out twice - then don't set CON_PRINTBUFFER for

the default serial console.

 

Index: drivers/serial/bfin_5xx.c

===================================================================

--- drivers/serial/bfin_5xx.c   (revision 7150)

+++ drivers/serial/bfin_5xx.c   (working copy)

@@ -1320,6 +1322,12 @@

        struct bfin_serial_port *uart;

        struct ktermios t;

 

+       /*

+        * If we are using early serial, don't let the normal console rewind

+        * log buffer, since that causes things to be printed multiple times

+        */

+       bfin_serial_console.flags &= ~CON_PRINTBUFFER;

+

        if (port == -1 || port >= nr_active_ports)

                port = 0;

        bfin_serial_init_ports();

 

 

It could be more specific - to see if early serial and console serial were

printing out on the _same_ UART before it did this - but this would seem to

catch 99% of the issues that people might have.

 

-Robin

 

--- Sonic Zhang                                              2009-08-12 23:03:25

But, if you disable CON_PRINTBUFFER in bfin_5xx.c and earlyprintk device is

different from normal serial console. You won't get boot information on the

normal console. Is this expected result?

 

If the double lines output boot infomation in my former citation is the

expected result from LKML's point of view, I have no problem to restore the

patch.

 

 

--- Robin Getz                                               2009-08-12 23:15:41

That is why I said - "see if early serial and console serial were

printing out on the _same_ UART before it did this".

 

But - yes -- It is expected behavior.

 

--- Sonic Zhang                                              2009-08-12 23:41:45

Restored.

 

--- Mingquan Pan                                             2009-08-14 05:06:24

Yes,it can show the normal boot up messages now even without configuring

earlyprink. So close.

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

No Files Were Found

Attachments

    Outcomes