* Re: [uml-devel] do_uml_initcalls
[not found] <20060507125412.GA16519@Starbuck>
@ 2006-05-07 14:09 ` Jeff Dike
2006-05-07 19:50 ` Blaisorblade
1 sibling, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2006-05-07 14:09 UTC (permalink / raw)
To: tyler, user-mode-linux-devel
On Sun, May 07, 2006 at 02:54:12PM +0200, user-mode-linux-devel-admin@lists.sourceforge.net wrote:
> First, there's a ';' at the end of line 6 : typo error I guess.
Yup, nice spotting.
> But my point is : this function is unreadable !
It could hardly get any simpler.
> 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.
> 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.
> 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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [uml-devel] do_uml_initcalls
[not found] <20060507125412.GA16519@Starbuck>
2006-05-07 14:09 ` [uml-devel] do_uml_initcalls Jeff Dike
@ 2006-05-07 19:50 ` Blaisorblade
1 sibling, 0 replies; 2+ messages in thread
From: Blaisorblade @ 2006-05-07 19:50 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: tyler
On Sunday 07 May 2006 14:54, user-mode-linux-devel-admin@lists.sourceforge.net
wrote:
> 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: }
>
> 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.
> 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.
> 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.
> 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.
--
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 2+ messages in thread