[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can arguments be passed to a running kernel module?

On Sun, Nov 01, 2009 at 12:18:03PM +0100, Klistvud wrote:
> Howdie, fellow Debianites!
> Is there a command for passing arguments to a running kernel module on 
> the fly, without rmmoding and re-modprobing it?

Yes . /proc/module/$MODULE/parameters

For instance, let's look at the module 'thermal'

$ /sbin/modinfo thermal
filename:       /lib/modules/2.6.26-2-amd64/kernel/drivers/acpi/thermal.ko
license:        GPL
description:    ACPI Thermal Zone Driver
author:         Paul Diefenbaugh
alias:          acpi*:LNXTHERM:*
depends:        thermal_sys,processor
vermagic:       2.6.26-2-amd64 SMP mod_unload modversions
parm:           act:Disable or override all lowest active trip points. (int)
parm:           crt:Disable or lower all critical trip points. (int)
parm:           tzp:Thermal zone polling frequency, in 1/10 seconds. (int)
parm:           nocrt:Set to take no action upon ACPI thermal zone critical trips points. (int)
parm:           off:Set to disable ACPI thermal support. (int)
parm:           psv:Disable or override all passive trip points. (int)

# The interface 
$ ls -l /sys/module/thermal/parameters/
total 0
-rw-r--r-- 1 root root 4096 2009-11-01 20:02 act
-rw-r--r-- 1 root root 4096 2009-11-01 20:02 crt
-rw-r--r-- 1 root root 4096 2009-11-01 20:02 psv
-r--r--r-- 1 root root 4096 2009-11-01 20:02 tzp

# Let's try reading current values, using a simple shortcut:

$ grep . /sys/module/thermal/parameters/*

As you can see, one parameter is strictly read-only. It can only be set
at module load time. The other three variables are writble (for root).
This immediately changes the value of that variable in kernel space.

> Echoing new value(s) to 
> the /proc subtree has long been deprecated now, and the new /sys 
> interface seems largely to be read-only ... 

The procfs tree is also mostly read-only.

BTW: /proc/sys is in no way deprecated.

Tzafrir Cohen         | tzafrir@jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzafrir@cohens.org.il |                    |  best
ICQ# 16849754         |                    | friend

Reply to: