Skip to contentSkip to conversation

do_uml_initcalls

uml-devel Jeff Dike 2 participants 2 messages May 7, 2006 1 message not in the archive User-mode Linux (UML)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20060507125412.GA16519@Starbuck

Jeff Dike

author
#1 lore raw
Quoted 1 line · On Sun, May 07, 2006 at 02:54:12PM +0200…

First, there's a ';' at the end of line 6 : typo error I guess.

Yup, nice spotting.

Quoted 1 line

But my point is : this function is unreadable !

It could hardly get any simpler.

Quoted 4 lines

It does simply call all the functions in the ".initcall" section.

Wouldn't it be better to call all the functions explicitely ?

No, adding an initcall now is a matter of writing it and declaring it as an initcall, which adds one contiguous piece of code to one file. Adding an explicit call means
writing the function
declaring it in a header so that do_uml_initcalls will see it including that header in the file that implements the function
to ensure that the implementation and declaration are the same
adding the call to do_uml_initcalls

Aside from the extra code that requires, the calls and the declarations would turn into a hot spot that a lot of patches change, and hot spots are a pain when it comes to reordering patches.

Quoted 1 line

Btw, what is the difference between the initcall and init sections ?

init sections are code which are executed only during initialization and which can be thrown out once the kernel is booted. initcall makes the function be automatically called, init just makes it be thrown out
- you have to arrange to call it yourself.

Quoted 3 lines

Because I was thinking of another problem : the modules. If some modules are compiled and that the init_modules functions are put in the initcall section, then all the modules will be loaded.

I don't think so. The init functions can only be called if they are in the kernel's initcall section, and then they aren't modules any more.

Jeff

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw
In reply to a message not in the archive
Quoted 15 lines · On Sunday 07 May 2006 14:54, [email protected]…

Hi all,

I was looking at the initialization code of UML and I found the function do_uml_initcalls :

1: static __init void do_uml_initcalls(void)
2: {
3: initcall_t *call;
4:
5: call = &__uml_initcall_start;
6: while (call < &__uml_initcall_end){;
7: (*call)();
8: call++;
9: }

Quoted 1 line

First, there's a ';' at the end of line 6 : typo error I guess.

Apart from this one, everything is like the general Linux kernel. See below.

Quoted 4 lines

But my point is : this function is unreadable !

It does simply call all the functions in the ".initcall" section.

Not exactly, that's .uml.initcall.init; see include/asm-um/common.lds.S:

  __uml_initcall_start = .;
  .uml.initcall.init : { *(.uml.initcall.init) }
  __uml_initcall_end = .;

Also, in the section there is a list of pointers, not the functions themselves.

Quoted 5 lines

Wouldn't it be better to call all the functions explicitely ?

Because I was thinking of another problem : the modules. If some modules are compiled and that the init_modules functions are put in the initcall section, then all the modules will be loaded.

Nothing from modules is linked inside the kernel.
The function set as module_init() function is put into the above section only if the code is linked statically, not as module. When it's a module it's put somewhere so when the module is loaded that function is called.

Quoted 1 line

That was just some thoughts :p

This idea is not new for UML - the linux kernel uses the same idea for .initcall.init section (we do that separately because some functions must be called at different moments). And that works.

Signature · 23 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel