All of lore.kernel.org
 help / color / mirror / Atom feed
* do_initcalls
@ 2005-11-25  7:41 Jaap de Jong
  2005-11-29  6:27 ` do_initcalls Gil Madar
  0 siblings, 1 reply; 8+ messages in thread
From: Jaap de Jong @ 2005-11-25  7:41 UTC (permalink / raw)
  To: linuxppc-embedded

Hi,

In linux-2.4.25/init/main.c this function is called:
=09
	static void __init do_initcalls(void)
	{
		initcall_t *call;
=09
		call =3D &__initcall_start;
		do {
			(*call)();
			call++
		} while (call < &__initcall_end);

		/* Make sure there is no pending stuff from the initcall
sequence */
		flush_scheduled_tasks();
	}

What is supposed to be in the section __initcall_start ..
__initcall_end?
Mine is empty and therefore causing trouble...
System.map:
	//
	//
	c00ad880 A __initcall_end
	c00ad880 A __initcall_start
	//
	//

The fix is obvious... But I guess I've missed something else?

Thanks in advance,
	Jaap de Jong
=09

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

* Re: do_initcalls
  2005-11-25  7:41 do_initcalls Jaap de Jong
@ 2005-11-29  6:27 ` Gil Madar
  0 siblings, 0 replies; 8+ messages in thread
From: Gil Madar @ 2005-11-29  6:27 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: Jaap de Jong

On Friday 25 November 2005 09:41, Jaap de Jong wrote:
>Hi,
>
>In linux-2.4.25/init/main.c this function is called:
>        
>        static void __init do_initcalls(void)
>        {
>                initcall_t *call;
>        
>                call = &__initcall_start;
>                do {
>                        (*call)();
>                        call++
>                } while (call < &__initcall_end);
>
>                /* Make sure there is no pending stuff from the initcall sequence */
>                flush_scheduled_tasks();
>        }
>
>What is supposed to be in the section __initcall_start ..
>__initcall_end?
>Mine is empty and therefore causing trouble...
>System.map:
>        //
>        //
>        c00ad880 A __initcall_end
>        c00ad880 A __initcall_start
>        //
>        //
>
>The fix is obvious... But I guess I've missed something else?
>
>Thanks in advance,
>        Jaap de Jong
Hi Jaap,

This is what I got on kernel 2.4.25:

c016a890 A __initcall_start
c016a890 A __setup_end
c016a890 t __initcall_abi_register_sysctl
c016a894 t __initcall_spawn_ksoftirqd
c016a898 t __initcall_uid_cache_init
c016a89c t __initcall_kmem_cpucache_init
c016a8a0 t __initcall_kswapd_init
c016a8a4 t __initcall_init_tmpfs
c016a8a8 t __initcall_bdflush_init
c016a8ac t __initcall_init_pipe_fs
c016a8b0 t __initcall_fasync_init
c016a8b4 t __initcall_filelock_init
c016a8b8 t __initcall_dnotify_init
c016a8bc t __initcall_init_script_binfmt
c016a8c0 t __initcall_init_elf_binfmt
c016a8c4 t __initcall_init_ramfs_fs
c016a8c8 t __initcall_init_devfs_fs
c016a8cc t __initcall_init_nfs_fs
c016a8d0 t __initcall_nfsd_init
c016a8d4 t __initcall_init_smb_fs
c016a8d8 t __initcall_init_devpts_fs
c016a8dc t __initcall_chr_dev_init
c016a8e0 t __initcall_raw_init
c016a8e4 t __initcall_device_init
c016a8e8 t __initcall_rd_init
c016a8ec t __initcall_loop_init
c016a8f0 t __initcall_ppp_init
c016a8f4 t __initcall_ppp_async_init
c016a8f8 t __initcall_deflate_init
c016a8fc t __initcall_netlink_proto_init
c016a900 t __initcall_inet_init
c016a904 t __initcall_ip_auto_config
c016a908 t __initcall_af_unix_init
c016a90c t __initcall_packet_init
c016a910 t __initcall_init_sunrpc
c016a914 A __initcall_end

HTH,
Gil

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

* do_initcalls
@ 2013-03-17 14:41 ishare
  2013-03-17 15:11 ` do_initcalls Tobias Boege
  0 siblings, 1 reply; 8+ messages in thread
From: ishare @ 2013-03-17 14:41 UTC (permalink / raw)
  To: kernelnewbies


 for (call = &__initcall_start; call < &__initcall_end; call++)
   (*call)();

 I want to know where are these  function point assigned by specified function ?

 thanks!

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

* do_initcalls
  2013-03-17 14:41 do_initcalls ishare
@ 2013-03-17 15:11 ` Tobias Boege
  2013-03-18  1:10   ` do_initcalls ishare
  0 siblings, 1 reply; 8+ messages in thread
From: Tobias Boege @ 2013-03-17 15:11 UTC (permalink / raw)
  To: kernelnewbies

On Sun, 17 Mar 2013, ishare wrote:
> 
>  for (call = &__initcall_start; call < &__initcall_end; call++)
>    (*call)();
> 
>  I want to know where are these  function point assigned by specified function ?
> 
>  thanks!

As per include/asm-generic/vmlinux.lds.h and your arch's vmlinux.lds.S (I
actually only looked at x86's), the __initcall_{start,end} variables are the
start and end of the __initcall ELF section which contains all the sub-level
sections.

Functions can be put into these sections when they are given to one
of the *_initcall macros from include/linux/init.h.

Regards,
Tobi

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

* do_initcalls
  2013-03-17 15:11 ` do_initcalls Tobias Boege
@ 2013-03-18  1:10   ` ishare
  2013-03-18 16:35     ` do_initcalls Tobias Boege
  0 siblings, 1 reply; 8+ messages in thread
From: ishare @ 2013-03-18  1:10 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Mar 17, 2013 at 04:11:54PM +0100, Tobias Boege wrote:
> On Sun, 17 Mar 2013, ishare wrote:
> > 
> >  for (call = &__initcall_start; call < &__initcall_end; call++)
> >    (*call)();
> > 
> >  I want to know where are these  function point assigned by specified function ?
> > 
> >  thanks!
> 
> As per include/asm-generic/vmlinux.lds.h and your arch's vmlinux.lds.S (I
> actually only looked at x86's), the __initcall_{start,end} variables are the
> start and end of the __initcall ELF section which contains all the sub-level
> sections.
> 
> Functions can be put into these sections when they are given to one
> of the *_initcall macros from include/linux/init.h.

  I have configure kernel  supporting rom filesystem ,and register it  by module_init(init_romfs_fs) ,
  but why the function : init_romfs_fs not be called from (*call)() ?

  thanks!


> 
> Regards,
> Tobi
> 
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

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

* do_initcalls
  2013-03-18  1:10   ` do_initcalls ishare
@ 2013-03-18 16:35     ` Tobias Boege
  2013-03-19  1:31       ` do_initcalls ishare
  0 siblings, 1 reply; 8+ messages in thread
From: Tobias Boege @ 2013-03-18 16:35 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 18 Mar 2013, ishare wrote:
> On Sun, Mar 17, 2013 at 04:11:54PM +0100, Tobias Boege wrote:
> > On Sun, 17 Mar 2013, ishare wrote:
> > > 
> > >  for (call = &__initcall_start; call < &__initcall_end; call++)
> > >    (*call)();
> > > 
> > >  I want to know where are these  function point assigned by specified function ?
> > > 
> > >  thanks!
> > 
> > As per include/asm-generic/vmlinux.lds.h and your arch's vmlinux.lds.S (I
> > actually only looked at x86's), the __initcall_{start,end} variables are the
> > start and end of the __initcall ELF section which contains all the sub-level
> > sections.
> > 
> > Functions can be put into these sections when they are given to one
> > of the *_initcall macros from include/linux/init.h.
> 
>   I have configure kernel  supporting rom filesystem ,and register it  by module_init(init_romfs_fs) ,
>   but why the function : init_romfs_fs not be called from (*call)() ?
> 
>   thanks!
> 

This is strange - *unless* you build romfs as a module. Have again a look at
the aforementioned include/linux/init.h. There's a fairly big comment on the
procedure:

/**
 * module_init() - driver initialization entry point
 * @x: function to be run at kernel boot time or module insertion
 *
 * module_init() will either be called during do_initcalls() (if
 * builtin) or at module insertion time (if a module).  There can only
 * be one per module.
 */

Regards,
Tobi

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

* do_initcalls
  2013-03-18 16:35     ` do_initcalls Tobias Boege
@ 2013-03-19  1:31       ` ishare
  2013-03-19 21:26         ` do_initcalls Tobias Boege
  0 siblings, 1 reply; 8+ messages in thread
From: ishare @ 2013-03-19  1:31 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Mar 18, 2013 at 05:35:29PM +0100, Tobias Boege wrote:
> On Mon, 18 Mar 2013, ishare wrote:
> > On Sun, Mar 17, 2013 at 04:11:54PM +0100, Tobias Boege wrote:
> > > On Sun, 17 Mar 2013, ishare wrote:
> > > > 
> > > >  for (call = &__initcall_start; call < &__initcall_end; call++)
> > > >    (*call)();
> > > > 
> > > >  I want to know where are these  function point assigned by specified function ?
> > > > 
> > > >  thanks!
> > > 
> > > As per include/asm-generic/vmlinux.lds.h and your arch's vmlinux.lds.S (I
> > > actually only looked at x86's), the __initcall_{start,end} variables are the
> > > start and end of the __initcall ELF section which contains all the sub-level
> > > sections.
> > > 
> > > Functions can be put into these sections when they are given to one
> > > of the *_initcall macros from include/linux/init.h.
> > 
> >   I have configure kernel  supporting rom filesystem ,and register it  by module_init(init_romfs_fs) ,
> >   but why the function : init_romfs_fs not be called from (*call)() ?
> > 
> >   thanks!
> > 
> 
> This is strange - *unless* you build romfs as a module. Have again a look at
> the aforementioned include/linux/init.h. There's a fairly big comment on the
> procedure:
> 
> /**
>  * module_init() - driver initialization entry point
>  * @x: function to be run at kernel boot time or module insertion
>  *
>  * module_init() will either be called during do_initcalls() (if
>  * builtin) or at module insertion time (if a module).  There can only
>  * be one per module.
>  */

   Does this mean it chould not be called during do_initcalls if I config it as   a module ?

   If this ,how to change it to be builtin module?
   
   what is  called  module insertion time? Is that time I explicitely  call some insert function?

   thanks!

> 
> Regards,
> Tobi
> 
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

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

* do_initcalls
  2013-03-19  1:31       ` do_initcalls ishare
@ 2013-03-19 21:26         ` Tobias Boege
  0 siblings, 0 replies; 8+ messages in thread
From: Tobias Boege @ 2013-03-19 21:26 UTC (permalink / raw)
  To: kernelnewbies

On Tue, 19 Mar 2013, ishare wrote:
> > /**
> >  * module_init() - driver initialization entry point
> >  * @x: function to be run at kernel boot time or module insertion
> >  *
> >  * module_init() will either be called during do_initcalls() (if
> >  * builtin) or at module insertion time (if a module).  There can only
> >  * be one per module.
> >  */
> 
>    Does this mean it chould not be called during do_initcalls if I config it as   a module ?
> 

do_initcalls() is done at boot time. If you insert a module into the running
kernel, how could its init function be called at boot time?

>    If this ,how to change it to be builtin module?
>    

Whether it is compiled as a module or not is a configuration issue. (Please,
CMIIW).

>    what is  called  module insertion time? Is that time I explicitely  call some insert function?
> 

I hope I got your question right (no, I hope I didn't but anyway here's my
answer to it): module insertion time is precisely the time a module is
inserted. You'd normally use modprobe or suchlike for this task.

As the comment above states, the function registered via module_init() is
called by the kernel's dynamic linker at this point.

I suggest to afford some of the well-known books on the Linux kernel. I
believe you can't avoid to do so when trying around with the kernel.

Regards,
Tobi

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

end of thread, other threads:[~2013-03-19 21:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-17 14:41 do_initcalls ishare
2013-03-17 15:11 ` do_initcalls Tobias Boege
2013-03-18  1:10   ` do_initcalls ishare
2013-03-18 16:35     ` do_initcalls Tobias Boege
2013-03-19  1:31       ` do_initcalls ishare
2013-03-19 21:26         ` do_initcalls Tobias Boege
  -- strict thread matches above, loose matches on Subject: below --
2005-11-25  7:41 do_initcalls Jaap de Jong
2005-11-29  6:27 ` do_initcalls Gil Madar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.