From owner-freebsd-stable Fri Apr 5 9:54:17 2002 Delivered-To: freebsd-stable@freebsd.org Received: from pc-62-31-80-192-ll.blueyonder.co.uk (pc-62-31-80-192-ll.blueyonder.co.uk [62.31.80.192]) by hub.freebsd.org (Postfix) with SMTP id 9D0F537B436 for ; Fri, 5 Apr 2002 09:53:42 -0800 (PST) Received: (qmail 215 invoked from network); 5 Apr 2002 17:53:40 -0000 Received: from spatula.home (HELO cream.org) (192.168.0.4) by myriad.home with SMTP; 5 Apr 2002 17:53:40 -0000 Message-ID: <3CADE4F1.4010805@cream.org> Date: Fri, 05 Apr 2002 18:54:57 +0100 From: Andrew Boothman User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.9) Gecko/20020312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: j mckitrick Cc: freebsd-stable@freebsd.org Subject: Re: Modules and kldunloads References: <20020405145809.A28418@dogma.freebsd-uk.eu.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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