public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* module_param() doesn't seem to work in 2.6.6-rc1
@ 2004-04-16 22:24 Pavel Roskin
  2004-04-16 23:35 ` Chris Wright
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pavel Roskin @ 2004-04-16 22:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: rusty

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: module_param() doesn't seem to work in 2.6.6-rc1
  2004-04-16 22:24 module_param() doesn't seem to work in 2.6.6-rc1 Pavel Roskin
@ 2004-04-16 23:35 ` Chris Wright
  2004-04-16 23:35 ` [PATCH] " Pavel Roskin
  2004-04-17  3:14 ` Rusty Russell
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Wright @ 2004-04-16 23:35 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: linux-kernel, rusty

* Pavel Roskin (proski@gnu.org) 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Re: module_param() doesn't seem to work in 2.6.6-rc1
  2004-04-16 22:24 module_param() doesn't seem to work in 2.6.6-rc1 Pavel Roskin
  2004-04-16 23:35 ` Chris Wright
@ 2004-04-16 23:35 ` Pavel Roskin
  2004-04-17  3:14 ` Rusty Russell
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Roskin @ 2004-04-16 23:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: rusty

[-- Attachment #1: Type: TEXT/PLAIN, Size: 957 bytes --]

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

[-- Attachment #2: Type: TEXT/PLAIN, Size: 540 bytes --]

--- linux.orig/kernel/module.c
+++ linux/kernel/module.c
@@ -1541,6 +1541,10 @@ static struct module *load_module(void _
 				      / sizeof(struct obsolete_modparm),
 				      sechdrs, symindex,
 				      (char *)sechdrs[strindex].sh_addr);
+		if (sechdrs[setupindex].sh_size)
+			printk(KERN_WARNING "%s: Ignoring new-style "
+			       "parameters in presence of obsolete ones\n",
+			       mod->name);
 	} else {
 		/* Size of section 0 is 0, so this works well if no params */
 		err = parse_args(mod->name, mod->args,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: module_param() doesn't seem to work in 2.6.6-rc1
  2004-04-16 22:24 module_param() doesn't seem to work in 2.6.6-rc1 Pavel Roskin
  2004-04-16 23:35 ` Chris Wright
  2004-04-16 23:35 ` [PATCH] " Pavel Roskin
@ 2004-04-17  3:14 ` Rusty Russell
  2 siblings, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2004-04-17  3:14 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: lkml - Kernel Mailing List

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-17  3:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-16 22:24 module_param() doesn't seem to work in 2.6.6-rc1 Pavel Roskin
2004-04-16 23:35 ` Chris Wright
2004-04-16 23:35 ` [PATCH] " Pavel Roskin
2004-04-17  3:14 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox