Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Apr 2002 18:54:57 +0100
From:      Andrew Boothman <andrew@cream.org>
To:        j mckitrick <jcm@FreeBSD-uk.eu.org>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Modules and kldunloads
Message-ID:  <3CADE4F1.4010805@cream.org>
References:  <20020405145809.A28418@dogma.freebsd-uk.eu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
j mckitrick wrote:
> Sorry I'm jumping into this thread so late.  I have done some
> experimenting with modules myself.  I helped turn a few devices into
> loadable modules, and I use a few on my system.  I use loader.conf to
> load sound, and when I do my system backups to ZIP I use kldload to load
> the driver.  However, I have problems when unloading these as well.
> 
> IIRC, unloading snd will cause a panic, but I never do that anyway.
> Unloading the ZIP driver doesn't kill anything, but reloading it makes
> the SCSI/CAM system act funny, and it allocates the device with an
> incrementally higher node number.  I tried getting the driver to
> disconnect from CAM properly, but this seems elusive at best.

Interestingly, it all seems to hinge on which module you loaded. For 
example, if you do a 'kldload snd' then you can't do a 'kldunload 
snd_sb16' or anything like that, because the kernel loaded them for you 
as a dependancy.

I tried adding 'snd_sb16_load="YES"' into my /boot/loader.conf, and the 
module correctly loaded and configured the device. However, you could 
not 'kldunload snd_sb16' or any other module apart from snd_sbc. When 
unloading snd_sbc the kernel correctly detached the sbc and pcm devices 
and unloaded the module.

It would appear that some sound modules can deal with being unloaded and 
some can't.... I'm not entirely sure of the details yet, so I won't 
submit the PR until I'm sure exactly what the situation is. More 
experimentation to be done tonight....

> I guess I thought I was the only one that put most of my drivers into
> modules and load them at boot time, rather than compiling them into the
> kernel.  Apparently, I'm not alone.

You're not alone, but I don't think it's very common. Like I mentioned 
before, they aren't really properly documented in the Handbook apart 
from a passing mention in the Sound section. I've often thought that it 
was strange that we are compiling all these modules when we compile our 
kernels, and yet we never seem to use them. Some are loaded 
automagically when the kernel needs to support something that it doesn't 
have compiled-in, but the whole thing still seems a little like black 
magic to me. If we knew that the system was robust then it could be 
added into the handbook as an alternative to constantly recompiling kernels.

> Please CC me in replies, since I'm not currently subscribed.

Then how did you know we were having the conversation? Spooky! :-)

Andrew.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CADE4F1.4010805>