tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Kernel modules - documentation?



On Sat, 22 May 2010, Adam Hamsik wrote:

My specific questions:

What actually triggers an autoload of a module? (There seem to be very few places where module_autoload() is called.)

Device module_autoloading is done in specfs_open.

OK. So I guess there's no generic "Gee, the kernel just tried to reference something that's not here, so maybe we can find a module to resolve that reference."

What is the semantic difference between module_autoload() and a "normal" module_load()?

module_autoload happens automatically when you try to open device node which doesn't have device driver in kernel.

My question was more along the lines of "what is the _difference_ between module_load() vs module_autoload()?" Or even simpler, "Why do both routines exist?" :)

Does the code which calls either of these routines need to be concerned with whether the module has been previously loaded? Is it OK to load a module that has already been loaded?


I think that this is not possible and these routines return an error when you try to do that.

That's OK, I'd expect the error. I can ignore that. I just need to be sure that the previously-loaded module doesn't get "screwed up" from the attempt to load it the second time.

Given that there is a kernel thread that runs around and attempts to unload any unreferenced modules that have been loaded "for a while",
is it ever necessary or desirable to explicitly unload a module?

It doesn't work this way there is a thread(workqueue) which try to unload module in first 300 seconds or mili seconds I can't remember now. But this thread or whatever is it doesn't unload modules older that set limit AFAIK.

Hmmm, I must have misunderstood this code - time to go look again.

What happens if a global symbol referenced by a module doesn't exist?
Does the module get loaded anyway, leaving the reference unresolved?

If you have a module which uses foo routine and it is not defined in kernel or loaded modules your module will simply not load.

This is actually what I was hoping would happen.


-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index