December 19, 2009

Find kernel driver/module

To find out what a particular driver/module does you can usually use the modinfo command:

# modinfo -d e1000
Intel(R) PRO/1000 Network Driver
#
# modinfo -d hangcheck-timer
Hangcheck-timer detects when the system has gone out to lunch past a certain margin.
#

To get a list of parameters supported by a kernel driver/module, the modinfo command will usually provide the information:

# modinfo -p e1000
debug:Debug level (0=none,...,16=all)
InterruptThrottleRate:Interrupt Throttling Rate
RxAbsIntDelay:Receive Absolute Interrupt Delay
RxIntDelay:Receive Interrupt Delay
TxAbsIntDelay:Transmit Absolute Interrupt Delay
TxIntDelay:Transmit Interrupt Delay
XsumRX:Disable or enable Receive Checksum offload
FlowControl:Flow Control setting
AutoNeg:Advertised auto-negotiation setting
Duplex:Duplex setting
Speed:Speed setting
RxDescriptors:Number of receive descriptors
TxDescriptors:Number of transmit descriptors
#
# modinfo -p hangcheck-timer
hangcheck_dump_tasks:If nonzero, the machine will dump the system task state when the timer margin is exceeded.
hangcheck_reboot:If nonzero, the machine will reboot when the timer margin is exceeded.
hangcheck_margin:If the hangcheck timer has been delayed more than hangcheck_margin seconds, the driver will fire.
hangcheck_tick:Timer delay.
#

To set the parameters when modules are loaded, you can add entries to /etc/modprobe.conf on RHEL or /etc/modprobe.conf.local on SLES. For example:

options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

To load the module and see the new settings, run:

# modprobe -v hangcheck-timer
insmod /lib/modules/2.6.9-22.EL/kernel/drivers/char/hangcheck-timer.ko hangcheck_tick=20 hangcheck_margin=280
#
# dmesg | tail -1
Hangcheck: starting hangcheck timer 0.5.0 (tick is 30 seconds, margin is 180 seconds).
#

The newly loaded module will be at the top of the lsmod list:

# lsmod | head -2
Module Size Used by
hangcheck_timer 3289 0
#

To unload the module, run:

# rmmod hangcheck-timer

No comments:

Post a Comment