Well, I would ammend this comment slightly.  If you ABSOLUTELY know what
you are doing, and if you are in a hackish mood, in a surprising number of
cases you can safely force a module to unload.  Of course if it caused
kernel corruption, you probably should reboot anyway.

You can always change its status flag to something like MOD_RUNNING and
its use count to 0, and either issue a delete_module() system call or
forcibly call cleanup_modulei() on it to (if you're lucky and the module
was written in a safe manner) force it to undo some of its changes to the
running kernel.  A surprising number of modules can be forced to go away
this way.  Especially stupid modules I have written which are really dead
(or stillborn) rt-processes that aren't even really doing anything.

Also, vmware's vmnet.o can be craftily forced to go away this way too.

Again, I do warn that in the end the safest thing is to reboot, but I HATE
rebooting, so I figure if you know what you're doing it's always fun to
hack away and force a kernel module to unload.

-Calin

On Wed, 5 Sep 2001, Norm Dresner wrote:

> No, and it's probably just as well because the kernel doesn't keep tables of 
>resources (ports, IRQ's, memory address ranges)
> allocated by loadable modules and therefore couldn't possibly undo whatever the 
>driver has already done.  This is, of course,
> assuming that the driver hasn't done any damage to the kernel when it crashed -- 
>which is another thing the kernel can't guarantee
> so it's probably safest to reboot ASAP.
>
> My problem hasn't been with getting the driver out but that -- at least in 
>2.2.18/RH6.2 -- it also apparently turns kernel logging
> off and there's no way to find out what any other drivers or devices might be doing 
>until the next time the machine is rebooted.
> This occurs even when the seg-fault in the loading in what I know -- because I 
>planted it as part of an experiment -- is a totally
> safe occurrence of trying to read from a bad address; there's no possible corruption 
>of the kernel in this situation but the driver
> is stuck and logging is off.
>
>
> Norman Dresner
> Fellow Avionics Support Systems Engineer &(SGI) Advanced Signal Processing 
>Laboratory Administrator
> Radar Systems Engineering Department
> Electronic Systems and Sensors Segment
> Northrop Grumman Corporation
> Baltimore-Washington International Airport
> 7323 Aviation Boulevard
> Baltimore Maryland 21240
>
> Voice: (410) 993 - 2096 Mornings; all-day voice-mail
>  (410) 969 - 8068 Afternoons with answering machine
> FAX: (410) 993 - 8084 On-site
>  (410) 969 - 8068 Afternoons; call first to arrange
> E-Mail: Mornings: mailto:[EMAIL PROTECTED]
>  Afternoons: mailto:[EMAIL PROTECTED]
>
> ----- Original Message -----
> From: Thamm, Russell <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, September 05, 2001 2:28 AM
> Subject: [rtl] How do I unload a crashed module?
>
>
> > Hi,
> >
> > I apparently have an error in init_module() and I get an exception message:
> >
> >   /usr/bin/rtlinux: line 161: 3155 Segmentation fault ${INSMOD} $modules
> >
> > when I load the module.
> >
> > However, after this I cannot unload the module :
> >
> >   Device or resource busy.
> >
> > Is there any way to recover from this apart from rebooting?
> >
> > thanks
> > Russell Thamm
> >
> >
> >
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > --
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/
> >
>
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
>
>

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to