module parameters versus kernel command line
Just curious: Is there any reason even dynamically loaded modules shouldn't be able to find module parameters on the kernel command line? I haven't actually investigated the code involved (since I have no idea where it is :-), but it sure seems like it would be convenient to have a single place to put module parameters where they would always be found regardless of the module's static or dynamic build mode (especially when multi-booting different kernels built different ways).
Quoted 10 lines · On Thu, 3 Apr 2008 09:00:53 -0400 Tom Horsley wrote:
Just curious: Is there any reason even dynamically loaded modules shouldn't be able to find module parameters on the kernel command line? I haven't actually investigated the code involved (since I have no idea where it is :-), but it sure seems like it would be convenient to have a single place to put module parameters where they would always be found regardless of the module's static or dynamic build mode (especially when multi-booting different kernels built different ways).
--
Does this answer your question? from Documentation/kernel-parameters.txt:
Module parameters for loadable modules are specified only as the parameter name with optional '=' and value as appropriate, such as:
modprobe usbcore blinkenlights=1
Module parameters for modules that are built into the kernel image are specified on the kernel command line with the module name plus '.' plus parameter name, with '=' and value if appropriate, such as:
usbcore.blinkenlights=1
---
~Randy
Quoted 5 lines · On Thu, 3 Apr 2008 08:39:53 -0700 Randy Dunlap <[email protected]> wrote:
Module parameters for modules that are built into the kernel image are specified on the kernel command line with the module name plus '.' plus parameter name, with '=' and value if appropriate, such as:
usbcore.blinkenlights=1
I know that part, I'm just wondering if it would be nice to have even dynamically loaded modules notice the kernel option so that the "usbcore" module would see the "blinkenlights=1" parameter from the kernel boot options when dynamically loaded?
That way, you wouldn't have to stop and figure out if a module was static or dynamic to decide if you need to edit the grub boot line or the modprobe.conf file.
Quoted 2 lines · On Thu, 3 Apr 2008 12:04:25 -0400 Tom Horsley wrote:
On Thu, 3 Apr 2008 08:39:53 -0700
Randy Dunlap <[email protected]> wrote:
Please use reply-to-all.
Quoted 6 lines
Quoted 5 lines
Module parameters for modules that are built into the kernel image are specified on the kernel command line with the module name plus '.' plus parameter name, with '=' and value if appropriate, such as:
usbcore.blinkenlights=1
Quoted 8 lines
I know that part, I'm just wondering if it would be nice to have even dynamically loaded modules notice the kernel option so that the "usbcore" module would see the "blinkenlights=1" parameter from the kernel boot options when dynamically loaded?
That way, you wouldn't have to stop and figure out if a module was static or dynamic to decide if you need to edit the grub boot line or the modprobe.conf file.
OK, that makes some sense to me.
Rusty added to cc for his objective viewpoint.
---
~Randy
Quoted 6 lines · On Friday 04 April 2008 02:14:44 Randy Dunlap wrote:
Quoted 5 lines · On Thu, 3 Apr 2008 12:04:25 -0400 Tom Horsley wrote:
I know that part, I'm just wondering if it would be nice to have even dynamically loaded modules notice the kernel option so that the "usbcore" module would see the "blinkenlights=1" parameter from the kernel boot options when dynamically loaded?
Quoted 7 lines
Quoted 3 lines
That way, you wouldn't have to stop and figure out if a module was static or dynamic to decide if you need to edit the grub boot line or the modprobe.conf file.
OK, that makes some sense to me.
Rusty added to cc for his objective viewpoint.
I agree with Randy; it has some appeal, but it's not a killer feature.
We already do the reverse: sysfs exposed parameters are the same for modules and builtins. If they're modifiable (most aren't), you don't have to care whether it's a module or not.
But there are also minor downsides. The first is that we currently warn about unused parameters (at least those containing '.'). We'd have to come up with something cleverer if we want to warn only about parameters which cannot be used by modules (ie. do it in userspace).
The second is that users might be surprised when they take the 'usbcore.blinkenlights' line out of their modprobe config file and it still applies. Most users use everything-is-a-module distributions.
Finally, it would be logical to take all the module parameters and autogen them into the kernel commandline, but it will soon hit cmdline limits (hmm, actually on my Ubuntu Hardy system here I think I'd be OK).
Cheers,
Rusty.
On Friday 04 April 2008, Rusty Russell wrote:
...
Quoted 3 lines
The second is that users might be surprised when they take the 'usbcore.blinkenlights' line out of their modprobe config file and it still applies. Most users use everything-is-a-module distributions.
Why don't do it in user space (let insmod/modprobe parse /proc/cmdline)?
1. Users won't be surprised after looking at the new man pages:)
2. it will work with older kernel
The warning problem is more complicated to fix.
Regards
Marc
Quoted 7 lines · On Friday 04 April 2008 21:45:37 Marc Pignat wrote:
On Friday 04 April 2008, Rusty Russell wrote:
...Quoted 3 lines
The second is that users might be surprised when they take the 'usbcore.blinkenlights' line out of their modprobe config file and it still applies. Most users use everything-is-a-module distributions.
Quoted 5 lines
Why don't do it in user space (let insmod/modprobe parse
/proc/cmdline)?
1. Users won't be surprised after looking at the new man pages:)
2. it will work with older kernelThe warning problem is more complicated to fix.
I like this idea, and also have module tools ship with
a 'check-kernel-cmdline' tool which handles the warnings for unusable cmdline params. Distributions can run this in their init scripts, and we can remove the warning from the kernel.
The best bit about this idea: it's now Jon's problem :)
Cheers,
Rusty.
Quoted 4 lines · On Sat, 5 Apr 2008 08:29:00 +1000 Rusty Russell <[email protected]> wrote:
I like this idea, and also have module tools ship with
a 'check-kernel-cmdline' tool which handles the warnings for unusable cmdline params. Distributions can run this in their init scripts, and we can remove the warning from the kernel.
Or maybe not have the warning at all, after all, even if sillymodule.sillyarg=1 doesn't make sense when I booted, who's to say I can't download the source to sillymodule, compile it, and modprobe it after boot time :-).
Quoted 8 lines · On Sunday 06 April 2008 08:54:44 Tom Horsley wrote:
On Sat, 5 Apr 2008 08:29:00 +1000
Quoted 4 lines · Rusty Russell
I like this idea, and also have module tools ship with
a 'check-kernel-cmdline' tool which handles the warnings for unusable cmdline params. Distributions can run this in their init scripts, and we can remove the warning from the kernel.
Quoted 4 lines
Or maybe not have the warning at all, after all, even if sillymodule.sillyarg=1 doesn't make sense when I booted, who's to say I can't download the source to sillymodule, compile it, and modprobe it after boot time :-).
I think it's worse not to have typo protection. Of course, our logs are so noisy they might miss the warning anyway.
Rusty.
Quoted 4 lines · Tom Horsley
I know that part, I'm just wondering if it would be nice to have even dynamically loaded modules notice the kernel option so that the "usbcore" module would see the "blinkenlights=1" parameter from the kernel boot options when dynamically loaded?
What if the module is loaded with parameters, and parameters are also specified in the kernel command line?
I'd suggest that the dynamic parameter should probably take precedence, as that would allow the user to specify things that were not necessarily known at boot time, while still providing a boot-time fallback.
Chris