Link order madness :-(
Hi, I was trying to make the IrDA stack work when compiled in the
kernel in 2.5.X (as opposed to modular). In 2.4.X, it sort of work, but whoever made changes to the IrDA init in 2.5.X obviously didn't bother to check what he was doing and check his changes.
So, I was trying to fix that, and I found a problem with
kernel link order.
The IrDA stack need to be initialised :
AFTER :
o the networking code (done in init/main.c)
o driver/char/random.c (done via __initcall())
BEFORE :
o IrDA drivers (done via module_init())
o IrDA higher protocols (done via module_init())
As both the random driver and the irda drivers are at the same
init level, there is no way to enforce those dependancies. Currently, the IrDA drivers are loaded before the IrDA stack (== kaboom).
Personally, I found it a bit strange the the random driver is
initialised so late in the game when the whole networking code (at least) depends on it.
Please advise...
Jean
Quoted 6 lines · Jean Tourrilhes
I was trying to make the IrDA stack work when compiled in the
kernel in 2.5.X (as opposed to modular). In 2.4.X, it sort of work, but whoever made changes to the IrDA init in 2.5.X obviously didn't bother to check what he was doing and check his changes.
So, I was trying to fix that, and I found a problem with
kernel link order.
It is possible that recent kbuild changes caused that.
[snip]
Quoted 8 lines
As both the random driver and the irda drivers are at the same
init level, there is no way to enforce those dependancies. Currently, the IrDA drivers are loaded before the IrDA stack (== kaboom).
Personally, I found it a bit strange the the random driver is
initialised so late in the game when the whole networking code (at leasxt) depends on it.Please advise...
I remember something like this happened awhile back with the IDE driver, trying to call a function in the cdrom driver before it was initialized.
There is a dirty workaround for this problem: Use a local static variable to condition the modules' initialization, and make each module call its init function inside every of its exported function, so this 'init-on-demand' will make sure the init code runs before the other module's code.
BTW, does the new driver model addresses this problem?
Signature · 2 lines
Dan Aloni [email protected]
Quoted 4 lines · Dan Aloni
Quoted 2 lines
So, I was trying to fix that, and I found a problem with
kernel link order.It is possible that recent kbuild changes caused that.
I don't think so, I took extra care to leave it all the same. (Well, except for sound/, which is outside drivers/) It'd however surely be a good idea to go through it and document which dependencies there are.
There's surely stuff which could be cleaned up (Jeff, as you're CC'ed anyway, look where tulip/ is linked in drivers/net/Makefile, I think that could be straightened up a bit)
W.r.t to the original problem I have to say I didn't really look into yet, but I think it makes e.g. a lot of sense to initialize networking earlier (subsys_initcall). We have initcall levels, using them right will help a lot. (The block subsystem is only __initcall a.k.a. driver_initcall as well, that's asking for problems at some point)
--Kai
Quoted 10 lines · Kai Germaschewski
Quoted 4 lines · Dan Aloni
Quoted 2 lines
So, I was trying to fix that, and I found a problem with
kernel link order.It is possible that recent kbuild changes caused that.
I don't think so, I took extra care to leave it all the same. (Well, except for
sound/, which is outsidedrivers/) It'd however surely be a good idea to go through it and document which dependencies there are.
Obviously Dan didn't bother to read my e-mail. The problem is
definitely not with kbuild. The problem is with the __define_initcall() levels.
Quoted 5 lines
W.r.t to the original problem I have to say I didn't really look into yet, but I think it makes e.g. a lot of sense to initialize networking earlier (
subsys_initcall). We have initcall levels, using them right will help a lot. (The block subsystem is only__initcalla.k.a.driver_initcallas well, that's asking for problems at some point)
The problem is *not* the networking initialisation (I wish
people were *reading* my e-mails). The basic networking is initialised early enough. The various networking stacks could be initialised earlier, but I don't depend on them. Note that there might be a reason to initialise networking after the file system, so to do that we might need to insert a level between fs_initcall() and device_initcall().
The problem is with the initialisation of the random
generator. It needs to be done earlier.
Quoted 1 line
--Kai
Regards,
Jean
Quoted 8 lines · Jean Tourrilhes
Quoted 7 lines · Kai Germaschewski
Quoted 4 lines · Dan Aloni
Quoted 2 lines
So, I was trying to fix that, and I found a problem with
kernel link order.It is possible that recent kbuild changes caused that.
Quoted 7 lines
Quoted 3 lines
I don't think so, I took extra care to leave it all the same. (Well, except for
sound/, which is outsidedrivers/) It'd however surely be a good idea to go through it and document which dependencies there are.Obviously Dan didn't bother to read my e-mail. The problem is
definitely not with kbuild. The problem is with the__define_initcall()levels.
I did in fact read your e-mail. I was just suggesting something that is drawn from previous experience concerning dependency problems with drivers compiled in as non-modules. And in my e-mail I was suggesting a workaround to make sure stuff gets initialized regardless of __initcall() levels.
Signature · 2 lines
Dan Aloni [email protected]