From owner-freebsd-current Sun Aug 19 0:21:28 2001 Delivered-To: freebsd-current@freebsd.org Received: from taxismtp1.alchemyfx.com (taxismtp1.alchemy.net [209.132.220.151]) by hub.freebsd.org (Postfix) with ESMTP id 9791C37B409 for ; Sun, 19 Aug 2001 00:21:24 -0700 (PDT) (envelope-from neckpain@nettaxi.com) Received: from localhost (L026157.ppp.dion.ne.jp [211.126.26.157]) by taxismtp1.alchemyfx.com (8.9.3/8.9.3) with ESMTP id AAA11589 for ; Sun, 19 Aug 2001 00:21:22 -0700 From: neckpain@nettaxi.com Message-Id: <200108190721.AAA11589@taxismtp1.alchemyfx.com> Date: Sun, 19 Aug 2001 16:21:35 +0900 To: current@FreeBSD.ORG Subject: Re: panic kldunload'ing: static sysctl oid too high References: <200108102252.PAA03031@taxismtp1.alchemyfx.com> <200108110622.XAA21343@taxismtp1.alchemyfx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Disposition: inline In-Reply-To: <200108110622.XAA21343@taxismtp1.alchemyfx.com> User-Agent: Mutt/1.3.19i-ja0 X-Dispatcher: imput version 20000228(IM140) Lines: 35 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Aug 11, 2001 at 03:22:21PM +0900, I wrote: > > - unloading snd_ds1 always panics(either when it's loaded from > > /boot/loader.conf, or from the command line by kldload). > > - loading and unloading snd_pcm alone does not panic(snd_pcm is a driver > > loaded as dependency when snd_ds1 is loaded). > > - unloading some other modules does not panic. > > - the last kernel I remember that didn't panic was from 2001.07.20.00.00.00 . > > And attached is a patch to kern_sysctl.c I'm using currently as a workaround. > It just adds a test mode to internal sysctl_remove_oid() and avoid > reregistering removed oid in sysctl_ctx_free(). Would someone please commit this or any better version? I think this is not specific to snd_ds1, but a small bug in kern_sysctl.c . 0. A KLD driver allocates an oid with OID_AUTO specified. It's assigned oid_number >= 0x100. 1. When the driver is unloaded, sysctl_ctx_free() is called from detach routine in a KLD driver. 2. Inside sysctl_ctx_free(), sysctl_remove_oid() is issued for each context entry to make sure the entire list can really be freed. If failed, it tries to restore once removed entries back to the list by sysctl_register_oid(). 3. sysctl_register_oid() rejects a dynamically allocated oid and panic. The "FIXME" code worked without a pain before kern_sysctl.c, rev 1.112 because sysctl_register_oid() didn't check if oid_number is below the range reserved for dynamic assignment of oid_number. [patch in <200108110622.XAA21343@taxismtp1.alchemyfx.com> omitted] By the way, I found recently that flood-pinging a PCCARD NIC(which shares irq9 with snd_ds1 driver) seems to make my non-working dsp device play sound. Really weird. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message