Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 05-06-2006, 11:02 AM   #1
LQ Newbie
Registered: Mar 2006
Posts: 7

Rep: Reputation: 0
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 = os.popen('rmmod module')

Last edited by mclerand; 05-06-2006 at 11:04 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
forcing a module to unload Ashrack Linux - General 1 01-25-2006 06:59 PM
how to unload kernel module dynamically kushneeraj Programming 1 10-26-2005 11:46 PM
Unload a module without rebooting? Phaethar Linux - Software 4 04-27-2005 12:42 PM
unload ub-module at boot? Urkburk Slackware 10 03-25-2005 05:35 AM
Unable to unload eepro100 module in Kernel 2.6 simjii Linux - General 0 12-08-2003 11:50 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:36 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration