LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Rapid module load/unload = Kernel panic (http://www.linuxquestions.org/questions/linux-kernel-70/rapid-module-load-unload-%3D-kernel-panic-442216/)

mclerand 05-06-2006 11:02 AM

Rapid module load/unload = Kernel panic
 
I am running Fedora Core 5 on and i686 arch. I wrote a Python script to rapidly load and unload my kernel module via insmod and rmmod. When I execute this script, it does not take long before a kernel panic ensues. I don't have any screen capture or any other info, since my Linux machine is at work. My kernel module is a pci-driver for some custom hardware. My module does not do much on init and exit, but something is going wrong. I have run the read and write functions of this module for millions of iterations with no problems. There doesn't seem to be anything wrong with the module, once it's loaded. The following is a summary of what I'm doing:


module init:
*zero-out my device struct, which contains a pci_dev* array along with other info
*create /proc entry
*grab 9 minor device numbers for the major device number obtained dynamically.
*scan the pci-bus for cards with a certain vendor id.
*call pci_get on all devices to retrieve a pci_dev* for the device.
*assign a shared irq for my card(s) and set the pci irq register in my hardware.
*call cdev_add

module exit:
*release the device numbers from init.
*remove /proc entry
*free_irq for each card.
*call pci_put to release the pci device.
*remove the cdev.

Something else to consider: This is a custom backplane that contains only my hardware. There isn't any other pci cards out there.

I can post more code on Monday, but I was wondering whether there was anything specific I need to worry about when loading/unloading kernel modules. Shouldn't I be able to load and unload them rapidly without a problem?

My Python code is something like:

while 1:
f = os.popen('insmod module.ko')
f.close()

f = os.popen('rmmod module')
f.close()


All times are GMT -5. The time now is 10:09 AM.