linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add kernel parameter to disable module load
@ 2012-01-28  3:34 Dave Young
  2012-01-29  0:51 ` Rusty Russell
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Young @ 2012-01-28  3:34 UTC (permalink / raw)
  To: rusty, linux-kernel

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.
---
 Documentation/kernel-parameters.txt |    2 ++
 kernel/module.c                     |    7 +++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e229769..b5cd482 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1796,6 +1796,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	nomfgpt		[X86-32] Disable Multi-Function General Purpose
 			Timer usage (for AMD Geode machines).
 
+	nomodule	Disable module load
+
 	nopat		[X86] Disable PAT (page attribute table extension of
 			pagetables) support.
 
diff --git a/kernel/module.c b/kernel/module.c
index 178333c..72395f5 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3478,6 +3478,13 @@ void print_modules(void)
 	printk("\n");
 }
 
+static int __init module_load_disable(char *str)
+{
+	modules_disabled = 1;
+	return 1;
+}
+__setup("nomodule", module_load_disable);
+
 #ifdef CONFIG_MODVERSIONS
 /* Generate the signature for all relevant module structures here.
  * If these change, we don't want to try to parse the module. */
-- 
1.7.4.4


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

* Re: [PATCH] add kernel parameter to disable module load
  2012-01-28  3:34 [PATCH] add kernel parameter to disable module load Dave Young
@ 2012-01-29  0:51 ` Rusty Russell
  2012-01-30  7:38   ` Dave Young
  2012-01-31  2:44   ` Dave Young
  0 siblings, 2 replies; 6+ messages in thread
From: Rusty Russell @ 2012-01-29  0:51 UTC (permalink / raw)
  To: Dave Young, linux-kernel

On Sat, 28 Jan 2012 11:34:50 +0800, Dave Young <dyoung@redhat.com> wrote:
> 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.


> +static int __init module_load_disable(char *str)
> +{
> +	modules_disabled = 1;
> +	return 1;
> +}
> +__setup("nomodule", module_load_disable);

You misspelled core_param here :)

Thanks,
Rusty.

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

* Re: [PATCH] add kernel parameter to disable module load
  2012-01-29  0:51 ` Rusty Russell
@ 2012-01-30  7:38   ` Dave Young
  2012-01-31  2:44   ` Dave Young
  1 sibling, 0 replies; 6+ messages in thread
From: Dave Young @ 2012-01-30  7:38 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

On 01/29/2012 08:51 AM, Rusty Russell wrote:

> On Sat, 28 Jan 2012 11:34:50 +0800, Dave Young <dyoung@redhat.com> wrote:
>> 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.
> 
> 
>> +static int __init module_load_disable(char *str)
>> +{
>> +	modules_disabled = 1;
>> +	return 1;
>> +}
>> +__setup("nomodule", module_load_disable);
> 
> You misspelled core_param here :)


Thanks for review, will update to use core_param

-- 
Thanks
Dave

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

* Re: [PATCH] add kernel parameter to disable module load
  2012-01-29  0:51 ` Rusty Russell
  2012-01-30  7:38   ` Dave Young
@ 2012-01-31  2:44   ` Dave Young
  2012-01-31  2:59     ` Rusty Russell
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Young @ 2012-01-31  2:44 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

On 01/29/2012 08:51 AM, Rusty Russell wrote:

> On Sat, 28 Jan 2012 11:34:50 +0800, Dave Young <dyoung@redhat.com> wrote:
>> 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.
> 
> 
>> +static int __init module_load_disable(char *str)
>> +{
>> +	modules_disabled = 1;
>> +	return 1;
>> +}
>> +__setup("nomodule", module_load_disable);
> 
> You misspelled core_param here :)
> 


Hello Rusty, If use core_param I'd better to change modules_disabled
from int to bool or we must pass nomodule=1 instead of simply pass
nomodule. But I think I can firstly post the core_param patch with
current int type, then work on the transition patch for the variable
type changes, what do you think?

Another do you think we need to expose this to sysfs via core_param?
According to the sysctl code looks like we should not add sysfs
interface to allow transition from "1" to "0"

-- 
Thanks
Dave

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

* Re: [PATCH] add kernel parameter to disable module load
  2012-01-31  2:44   ` Dave Young
@ 2012-01-31  2:59     ` Rusty Russell
  2012-01-31  3:36       ` Dave Young
  0 siblings, 1 reply; 6+ messages in thread
From: Rusty Russell @ 2012-01-31  2:59 UTC (permalink / raw)
  To: Dave Young; +Cc: linux-kernel

On Tue, 31 Jan 2012 10:44:50 +0800, Dave Young <dyoung@redhat.com> wrote:
> On 01/29/2012 08:51 AM, Rusty Russell wrote:
> 
> > On Sat, 28 Jan 2012 11:34:50 +0800, Dave Young <dyoung@redhat.com> wrote:
> >> 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.
> > 
> > 
> >> +static int __init module_load_disable(char *str)
> >> +{
> >> +	modules_disabled = 1;
> >> +	return 1;
> >> +}
> >> +__setup("nomodule", module_load_disable);
> > 
> > You misspelled core_param here :)
> > 
> 
> 
> Hello Rusty, If use core_param I'd better to change modules_disabled
> from int to bool or we must pass nomodule=1 instead of simply pass
> nomodule. But I think I can firstly post the core_param patch with
> current int type, then work on the transition patch for the variable
> type changes, what do you think?

You could code your set function, but "bint" is what you want.  Cleaning
it up to be a bool is a good idea too.

> Another do you think we need to expose this to sysfs via core_param?
> According to the sysctl code looks like we should not add sysfs
> interface to allow transition from "1" to "0"

If you want it writable, you definitely want to code your own set
function so it's one way.  But perm 0 or 0444 make sense, too.

Cheers,
Rusty.

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

* Re: [PATCH] add kernel parameter to disable module load
  2012-01-31  2:59     ` Rusty Russell
@ 2012-01-31  3:36       ` Dave Young
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Young @ 2012-01-31  3:36 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

On 01/31/2012 10:59 AM, Rusty Russell wrote:

> On Tue, 31 Jan 2012 10:44:50 +0800, Dave Young <dyoung@redhat.com> wrote:
>> On 01/29/2012 08:51 AM, Rusty Russell wrote:
>>
>>> On Sat, 28 Jan 2012 11:34:50 +0800, Dave Young <dyoung@redhat.com> wrote:
>>>> 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.
>>>
>>>
>>>> +static int __init module_load_disable(char *str)
>>>> +{
>>>> +	modules_disabled = 1;
>>>> +	return 1;
>>>> +}
>>>> +__setup("nomodule", module_load_disable);
>>>
>>> You misspelled core_param here :)
>>>
>>
>>
>> Hello Rusty, If use core_param I'd better to change modules_disabled
>> from int to bool or we must pass nomodule=1 instead of simply pass
>> nomodule. But I think I can firstly post the core_param patch with
>> current int type, then work on the transition patch for the variable
>> type changes, what do you think?
> 
> You could code your set function, but "bint" is what you want.  Cleaning
> it up to be a bool is a good idea too.


Thanks. I will try bint. Will consider to make it bool later because
sysctl also need some changes.

> 
>> Another do you think we need to expose this to sysfs via core_param?
>> According to the sysctl code looks like we should not add sysfs
>> interface to allow transition from "1" to "0"
> 
> If you want it writable, you definitely want to code your own set
> function so it's one way.  But perm 0 or 0444 make sense, too.


I like 'perm 0' :)

> 
> Cheers,
> Rusty.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
Thanks
Dave

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

end of thread, other threads:[~2012-01-31  3:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-28  3:34 [PATCH] add kernel parameter to disable module load Dave Young
2012-01-29  0:51 ` Rusty Russell
2012-01-30  7:38   ` Dave Young
2012-01-31  2:44   ` Dave Young
2012-01-31  2:59     ` Rusty Russell
2012-01-31  3:36       ` Dave Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).