From owner-freebsd-hackers Tue Apr 29 20:32:43 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id UAA29960 for hackers-outgoing; Tue, 29 Apr 1997 20:32:43 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id UAA29955 for ; Tue, 29 Apr 1997 20:32:40 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id NAA25320; Wed, 30 Apr 1997 13:02:34 +0930 (CST) From: Michael Smith Message-Id: <199704300332.NAA25320@genesis.atrad.adelaide.edu.au> Subject: Unloading LKMs (was Re: A Desparate Plea for Help...) In-Reply-To: <199704291010.UAA30468@godzilla.zeta.org.au> from Bruce Evans at "Apr 29, 97 08:10:18 pm" To: bde@zeta.org.au (Bruce Evans) Date: Wed, 30 Apr 1997 13:02:33 +0930 (CST) Cc: hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Bruce Evans stands accused of saying: > >Please keep me up to date on the results of your LKM-related tests. If > >it turns out that there's a problem with unloading LKMs leaving occupied > >but invalid devsw entries around we'd better fix it 8) > > Er, AFAIK unloading LKM drivers is broken in all cases. It certainly > doesn't work for either of the officially supported LKM cdevs (joy > and qcam). Unloading either of these and then attempting to opening > the nonexistent device gives precisely the trap at _spec_open+0x6e that > Simon reported (the devsw entry is not affected by unloading and points > to garbage). Unloading followed by reloading obviously can't work, > because the driver only initializes the devsw once. Um, the driver initialises the devsw on every load, does it not? eg: static int qcam_load (struct lkm_table *lkmtp, int cmd) { if (qcam_probe(&qcam_mod_dev)) { qcam_attach(&qcam_mod_dev); qcam_drvinit(NULL); /* XXX this shouldn't NEED to be here * the LKM code should be doing this * for us! */ ... Still, I take your point about the cdevsw not being updated. I can't see a clean way of doing this, either. Doug R., how do you approach this in your New Module Structure? (No, I haven't had time to read it yet 8( 8( 8( ) > Bruce -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[