From owner-freebsd-new-bus Thu Dec 2 8:26:49 1999 Delivered-To: freebsd-new-bus@freebsd.org Received: from ns.skylink.it (ns.skylink.it [194.177.113.1]) by hub.freebsd.org (Postfix) with ESMTP id BCD5B14BD7 for ; Thu, 2 Dec 1999 08:26:42 -0800 (PST) (envelope-from hibma@skylink.it) Received: from skylink.it (va-151.skylink.it [194.185.55.151]) by ns.skylink.it (8.9.1/8.8.8) with ESMTP id RAA03390; Thu, 2 Dec 1999 17:26:10 +0100 Received: from localhost (localhost [127.0.0.1]) by skylink.it (8.9.3/8.9.3) with ESMTP id RAA02598; Thu, 2 Dec 1999 17:01:20 +0100 (CET) (envelope-from hibma@skylink.it) Date: Thu, 2 Dec 1999 17:01:20 +0100 (CET) From: Nick Hibma X-Sender: n_hibma@henny.jrc.it Reply-To: Nick Hibma To: Doug Rabson Cc: FreeBSD Newbus Mailing List Subject: Re: PCCARD eject freeze (was Re: your mail) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-new-bus@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > device_detach deletes the softc allocated for the device. > > Drivers cache copies of softc in their ISRs and other places where > > they sleep and count on the cached copy of softc to still be around > > when they are woken up. If a pccard is ejected between these points, > > these cached copies disappear because the ejection code deletes the > > device from the device tree (an as a side effect calls detach, which > > frees the softc for the device). > > > > Suspend has a similar problem because it can come in while a > > device is sleeping. > > The device_detach routine *must* teardown all interrupt handlers and > release all resources. If this rule is followed, then the handler > shouldn't be called after detach, so there is no problem, right? The problem is that the following occurs now: DEVICE_DETACH called from device_delete_child wakes up all the sleepers and exits. The sleepers actually start running after DEVICE_DETACH has finished and the softc has been blown away by the device_delete_child that followed. I think this cries for a loop: Call detach and if EAGAIN is returned make sure sleepers can wake up and exit, and then try again. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I have no idea how this 'wait for sleepers to have run' could be implemented, but this is I think the crucial part. Nick -- hibma@skylink.it n_hibma@freebsd.org USB project http://www.etla.net/~n_hibma/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-new-bus" in the body of the message