module: add kernel param to force disable module load
authorDave Young <dyoung@redhat.com>
Wed, 1 Feb 2012 02:33:14 +0000 (10:33 +0800)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 26 Mar 2012 02:20:50 +0000 (12:50 +1030)
Sometimes we need to test a kernel of same version with code or config
option changes.

We already have sysctl to disable module load, but add a kernel
parameter will be more convenient.

Since modules_disabled is int, so here use bint type in core_param.
TODO: make sysctl accept bool and change modules_disabled to bool

Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Documentation/kernel-parameters.txt
kernel/module.c

index 58eac231fe694649e493aac00b8510028233cfa0..e2f8c297a8a4f93e5771e2341a1fe53a544ffe34 100644 (file)
@@ -1869,6 +1869,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                        shutdown the other cpus.  Instead use the REBOOT_VECTOR
                        irq.
 
+       nomodule        Disable module load
+
        nopat           [X86] Disable PAT (page attribute table extension of
                        pagetables) support.
 
index 2c932760fd33d152016e62431cba5c986f65957f..7e31da9750c08666362b7fd77aa6dc20b1ad0c08 100644 (file)
@@ -105,6 +105,7 @@ struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */
 
 /* Block module loading/unloading? */
 int modules_disabled = 0;
+core_param(nomodule, modules_disabled, bint, 0);
 
 /* Waiting for a module to finish initializing? */
 static DECLARE_WAIT_QUEUE_HEAD(module_wq);