LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Show options that kernel module was loaded with? (https://www.linuxquestions.org/questions/linux-general-1/show-options-that-kernel-module-was-loaded-with-624228/)

fmyhr 02-27-2008 09:21 AM

Show options that kernel module was loaded with?
 
Hi,

Anyone know a way to tell what options a kernel module was loaded with? Something like /proc/cmdline but for loadable modules? I've googled and poked around /sys and /proc without luck...

Thanks,
Frank

mahmoud 02-27-2008 11:21 AM

uname -a will tell you the kernel you are running if that helps
or go into /boot/grub/menu.lst you will see the boot menu

fmyhr 02-27-2008 03:51 PM

Thanks for the quick reply, mahmoud.

Your suggestions are good for seeing the name/version of the running kernel, and the kernel boot options for each kernel that grub knows about (just as you said).

I was hoping to find a way to determine what options/parameters had been fed into a loadable kernel module at the time it was loaded. These options are set in files in /etc/modprobe.d/

I've poked around a bit more and I think the answer is that there isn't a way to tell what parameters were set when the module got loaded. Each module can display a subset of its parameters in /sys. For example, loading the module snd_usb_audio creates the directory:
/sys/module/snd_usb_audio/parameters

In /etc/modprobe.d/options I have the line:
options snd_usb_audio async_unlink=0

and after loading that module I get:
% cat /sys/module/snd_usb_audio/parameters/async_unlink
N

But AFAIK it's up to each module to decide which of its parameters to export to /sys. And the values in /sys reflect the current state, not the state requested when the module was loaded.

If anyone knows differently, please tell me :-)

Thanks again,
Frank

tredegar 02-27-2008 06:08 PM

Frank,
If you told us what your exact problem is, rather than just the steps you have taken to try to resolve it, we might be able to see the bigger picture and be better informed to help you.

fmyhr 02-27-2008 09:40 PM

Hi tredegar,

Sorry if I was so mysterious :-) Bigger picture is I am loading thinkpad_acpi on a 600X running kubuntu gutsy. Wanted to see if I could control the fan, so put this in /etc/modules.d/options:
options thinkpad_acpi fan_control=1

When I loaded the thinkpad_acpi module I could see /proc/acpi/ibm/fan but trying
echo 'level 1' > /proc/acpi/ibm/fan
gave a "write error: invalid argument"

Before concluding that the 600x doesn't support fan control through thinkpad_acpi, I thought I'd make sure that the fan_control=1 option was in fact being set when the module was loaded. I couldn't tell for sure from the system log, so wondered if there was some other way to tell. Since then I've tried setting the thinkpad_acpi options debug=0xffff or debug=0x0000 in /etc/modules.d/options and can see the difference between these two in the number of things being logged during module load. So I have to conclude that the fan_control=1 option is being picked up but simply does not work on the 600x.

Bottom line is that I had no reason to suspect that /etc/modprobe.d options weren't being set, but grew curious if there was any way to tell. And short answer AFAICT is that in the general case there is no way to tell.

Thanks,
Frank

tredegar 02-28-2008 05:17 AM

This is "experimental", and the module needs to be loaded with the experimental=1 option, for you even to attempt to control the fanspeed.

See here: http://ibm-acpi.sourceforge.net/README

TFL 01-28-2009 08:29 AM

systool is your friend...
 
Hi

Try using systool. For example, I view the active options for my storage controllers using systool -c scsi_host -av or systool -c fc_host -av.

Regards, Mike

fmyhr 01-29-2009 08:28 AM

systool
 
Mike, thanks for pointing out systool. Can be handier than poking around manually through /sys

In case it helps anybody else, systool is part of the sysfsutils package on Debian and Ubuntu.


All times are GMT -5. The time now is 03:53 AM.