linux-mips
[Top] [All Lists]

RE: early_initcall

To: linux-mips@linux-mips.org
Subject: RE: early_initcall
From: Ashlesha Shintre <ashlesha@kenati.com>
Date: Wed, 06 Sep 2006 11:10:47 -0700
In-reply-to: <66910A579C9312469A7DF9ADB54A8B7D366028@exchange.ZeugmaSystems.local>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <66910A579C9312469A7DF9ADB54A8B7D366028@exchange.ZeugmaSystems.local>
Reply-to: ashlesha@kenati.com
Sender: linux-mips-bounce@linux-mips.org
I googled early_initcall and found a patch which basically adds this
line to the /include/init.h file:

#define early_initcall(fn)             __define_initcall(".early1",fn)

I built a kernel image with this new line included and now if I try
executing it, the bootloader YAMON gives an exception error before it
can even begin!  Here is the dump:

************************* User Exception
**********************************
    Exception State 24  Machine check

(((((((((((((((((((( CPU Registers )))))))))))))))))))))))))))))
zr: 00000000  at: 10007c00  v0: 00000003  v1: 00000004
a0: 14000017  a1: 14080017  a2: 50000000  a3: 00000000
t0: 40000000  t1: 01ffe000  t2: 80400000  t3: 80410000
t4: 80400000  t5: fffffffe  t6: ffffffff  t7: 00000010
s0: 10007c00  s1: 80380000  s2: 80400000  s3: 80401c5c
s4: 80400000  s5: 803affc0  s6: 00000000  s7: 00000000
t8: 00000006  t9: 803afde6  k0: 00000000  k1: 00000000
gp: 803ae000  sp: 803aff10  s8: 800e8380  ra: 803f68c0

{{{{{{{{{{{{{{{{{{{{{ CP0 Registers }}}}}}}}}}}}}}}}}}}}}}}}}}}}}
   Index: 00000003        Random: 00000019    EntryLo0: 14000017
EntryLo1: 14080017       Context: 007ffff0   Page Mask: 00000000
Wired NO: 00000004         Reg 7: 00000000       Reg 8: fffffff4
   Reg 9: 4d691cb7      Entry Hi: 50000000      Reg 11: 00000000
  Reg 12: 10007c02        Reg 13: 00808060      Reg 14: 803f0484
Proc ID: 01030200      ERROREPC: 00000000      Config: 80008083
Config 1: 00000000      WatchLo: 00000000     WatchHi: 80000000
    Debug: 00008000         DEPC: 00000000


   STATUS: 10007c02
    CAUSE: 00808060
      EPC: 803f0484
BADVADDR: fffffff4
       LO: 04000000
       HI: 00000000


A machine check means that an exception is generated due to duplicate
TLB entries.  I dont understand why the kernel crashes so early.

Also, what does the ".early1" mean? Is that a definition of a different
segment in the init.h file?

I checked output of the "readelf -a vmlinux" and found that the address
for the early_initcall comes up about 5 times.  I m not sure what each
of the fields mean, so I have attached the above part of the readelf in
a file called readelf.

Thank you!
Ashlesha.



On Fri, 2006-09-01 at 17:50 -0700, Kaz Kylheku wrote:
>  > Ashlesha Shintre wrote:
> > 
> > Hi,
> > 
> > I m using the 2.6.14.6 tree and trying to get the kernel 
> > running on the
> > Encore M3 board.  
> > 
> > The kernel crashes during the boot process at the 
> > early_initcall.
> 
> What is the exact output from the crash?
> 
> > This function doesnt seem to be defined anywhere.
> 
> It's not a function, but a macro. The macro is used to annotate a
> function as being among the list of functions that are called at startup
> by the "initcall" mechanism: a big loop that sweeps over a symbol table
> of registered initialization functions and calls them. E.g.
> 
>   #include <linux/init.h>
> 
>   /* ... */
> 
>   int __init my_initialization_function(void)
>   {
>     printk(KERN_INFO "Hello, world\n");
>   }
> 
>   early_initcall(my_initialization_function);
> 
> The __init tells the kernel build system that your function is not
> needed after initialization and its memory can be thrown away. The
> early_initcall arranges for the initialization call. Early means that
> it's in the first group of functions.
> 
> If you suspect your kernel is dying during the calling of the initcall
> functions, you can turn on initcall debugging. Add these parameters to
> your kernel command line:
> 
>    debug debug_initcall
> 
> Hope this helps.
> 
> 

Attachment: readelf.doc
Description: MS-Word document

<Prev in Thread] Current Thread [Next in Thread>