From owner-cvs-all Tue Mar 6 13:39:26 2001 Delivered-To: cvs-all@freebsd.org Received: from meow.osd.bsdi.com (meow.osd.bsdi.com [204.216.28.88]) by hub.freebsd.org (Postfix) with ESMTP id B097337B718; Tue, 6 Mar 2001 13:39:17 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by meow.osd.bsdi.com (8.11.2/8.11.2) with ESMTP id f26Ld6A51877; Tue, 6 Mar 2001 13:39:06 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200103062100.f26L0PO08347@aslan.scsiguy.com> Date: Tue, 06 Mar 2001 13:38:51 -0800 (PST) From: John Baldwin To: "Justin T. Gibbs" Subject: Re: cvs commit: src/sys/kern kern_intr.c src/sys/sys interrupt.h Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 06-Mar-01 Justin T. Gibbs wrote: >>You can't free it before it is run, but you can free it while it is already >>running. > > That's a question of semantics I suppose. There must be a window between > when you last check to see if the handler is dead and you actually get > to a point in the interrupt handler where you could acquire some other > lock that might protect your data from going away. To me that is being > freed before being run. Fair enough. >> A tsleep/wakeup pair between ithread_remove_handler() and >>ithread_loop() can be used to work around this, however. Untested patch >>included below. > > I haven't tested this either, but it should work. We should also update > the manual page to indicate that you must deregister from a context > that can sleep. In SMPNG, there should be very few places where you > can't sleep. Right now interrupt handlers and any place holding a mutex are the only places where sleeping is bad. Are you referring to bus_teardown_intr(9)? >>The IH_DEAD flag is the state in question. However, one thing I may play >>with >>is just locking the list with a mutex at some point in time, as it may not >>end >>up being all that expensivem, esp. since it would almost always be >>non-contested. Not sure about this yet, though. > > Unecessary locks are, unecessary. Well, there's a lot of extra hacking in here to make it unnecessary. Using a lock would simplify the code immensely and make future maintenance easier. > -- > Justin -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message