2004-04-16 22:28:25

by Pavel Roskin

[permalink] [raw]
Subject: module_param() doesn't seem to work in 2.6.6-rc1

Hello!

I know that module_param is supposed to obsolete MODULE_PARM in 2.6
kernels. However, module_param doesn't seem to work in Linux 2.6.6-rc1 (I
didn't test older kernels, so I don't know if it's a new bug).

I don't see any way to supply description with the new interface described
in moduleparam.h. I see that some drivers (e.g. drivers/net/e100.c) use
MODULE_PARM_DESC together with module_param. This seems wrong to me.
Shouldn't a new interface provide a new way to describe the parameters?

If MODULE_PARM or module_param is used without MODULE_PARM_DESC, modinfo
(module-init-tools version 3.0) fails to list the parameter. It would be
great if the parameter was listed, even without description.

A bigger problem is that the new parameters cannot be used on the modprobe
command line. I added this to orinoco.c:

static int parmtest1, parmtest2;
MODULE_PARM(parmtest1, "i");
module_param(parmtest2, int, 644);

After compiling and installing the module I tried this:

# modprobe orinoco parmtest1=1 parmtest2=2
FATAL: Error inserting orinoco
(/lib/modules/2.6.6-rc1/kernel/drivers/net/wireless/orinoco.ko): Unknown
symbol in module, or unknown parameter (see dmesg)

Kernel log shows:
orinoco: Unknown parameter `parmtest2'

Search for module_param in the Linux Documentation directory yielded
nothing. I did notice, however, that the rate of adoption of module_param
is very low in the drivers directory. Most drivers still use MODULE_PARM.
Isn't it because module_param is totally undocumented?

$ find drivers -name '*.c' | xargs grep '\<module_param\>' | wc -l
244
$ find drivers -name '*.c' | xargs grep '\<MODULE_PARM\>' | wc -l
1731

module_param is not mentioned in the sources of module-init-tools-3.0. I
found this document that mentions "Optional viewing and control through
sysfs":

http://www.kernel.org/pub/linux/kernel/people/rusty/2.4_module_param_Forward_Compatibility_Macros.html

But even when I loaded the "orinoco" module without parameters. I tried
this:

# find /sys | grep par
# find /sys | xargs grep -i par 2>/dev/null
#

Relevant settings from .config:

CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
CONFIG_OBSOLETE_MODPARM=y
CONFIG_MODVERSIONS=y
CONFIG_KMOD=y

i686, non-SMP, Fedora Core 1.

--
Regards,
Pavel Roskin


2004-04-16 23:35:10

by Chris Wright

[permalink] [raw]
Subject: Re: module_param() doesn't seem to work in 2.6.6-rc1

* Pavel Roskin ([email protected]) wrote:
> A bigger problem is that the new parameters cannot be used on the modprobe
> command line. I added this to orinoco.c:
>
> static int parmtest1, parmtest2;
> MODULE_PARM(parmtest1, "i");
> module_param(parmtest2, int, 644);

You can not mix the use of the two.

thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net

2004-04-16 23:37:06

by Pavel Roskin

[permalink] [raw]
Subject: [PATCH] Re: module_param() doesn't seem to work in 2.6.6-rc1

On Fri, 16 Apr 2004, Pavel Roskin wrote:

> A bigger problem is that the new parameters cannot be used on the modprobe
> command line. I added this to orinoco.c:
>
> static int parmtest1, parmtest2;
> MODULE_PARM(parmtest1, "i");
> module_param(parmtest2, int, 644);

P.S. load_module() in kernel/module.c would not check new parameters if
old parameters are present. In my tests old parameters were always
present. Once I converted everything, the parameters started working
again.

Parsing both types of parameters may be non-trivial, and should not be
really needed. However, a warning could have saved me some time.

The attached patch prints a warning if both new-style and obsolete
parameters are present in the module. The warning is printed regardless
of whether any parameters are specified, which is intentional.

Several drivers under drivers/pcmcia have this problem. The patch will be
posted to the pcmcia list.

--
Regards,
Pavel Roskin


Attachments:
parm_warning.diff (540.00 B)

2004-04-17 03:14:45

by Rusty Russell

[permalink] [raw]
Subject: Re: module_param() doesn't seem to work in 2.6.6-rc1

On Sat, 2004-04-17 at 08:24, Pavel Roskin wrote:
> Hello!
>
> I know that module_param is supposed to obsolete MODULE_PARM in 2.6
> kernels. However, module_param doesn't seem to work in Linux 2.6.6-rc1 (I
> didn't test older kernels, so I don't know if it's a new bug).

You can't mix old and new: only the old will work in that case.

Sorry for the confusion,
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell