D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] How to find out what is using a kernel module?

 

Neil Williams wrote:
> On Tue, 27 Feb 2007 23:22:22 +0000
> Simon Williams <systemparadox@xxxxxxxxxxxxxx> wrote:
> 
>> Is there some program which will tell me what is using a given kernel
>> module? Something a bit like lsof or fuser I guess, but with kernel
>> modules instead of files.
> 
> lsmod
> 
> That shows you which other modules will be using that module which is
> generally more useful than it sounds because it helps work out what the
> zd124rw module does when it's not obvious from the name.

I was hoping lsmod had a process option, but it doesn't have anything.
I know exactly what the module does.

> dmesg can also give you clues, but there is no definitive way of
> knowing which applications use which modules, except trying to run the
> app without the module in place. e.g. No end of applications rely on a
> network module of some kind but that won't be listed as a dependency of
> the package. rmmod is a fairly destructive way of working out which
> programs need a specific module. :-)

The whole reason I want to do this is so that I can remove the module.

> Modules themselves do keep track of a user count (/proc/modules) which
> must be 0 before the module can be removed.
> 
> It depends what kind of module you want to track really: a device
> driver, a filesystem driver, a system call, a network driver, an
> emulator . . .

The module is bt3c_cs- the driver for my 3Com PCMCIA bluetooth card. It 
could be in use by anything that uses bluetooth, but the most likely 
ones are hcid, hidd, etc and kbluetoothd.
The problem is that after a suspend the card cannot reinitialise- its 
hardware address is stuck at 00:00:00:00:00 in hciconfig, and hciconfig 
hci0 reset or hciconfig hci0 up says connection timed out.
If I close all bluetooth applications, stop bluetooth services, 
hciconfig hci0 down, rmmod bt3c_cs, modprobe bt3c_cs, and start 
everything back up again it works fine.

I really would like some way of reloading the module without having to 
kill all the applications, but I don't think that's possible. I guess 
the point is that the module is supposed to handle the resetting itself 
(why do no module developers account for people who suspend?).

Both rmmod -w and rmmod -f just sit there.

Physically removing the card stops the use of it, but I want to have 
this done automatically.

Thanks
Simon

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html