Date: Sun, 04 Mar 2001 11:12:50 -0700 From: "Justin T. Gibbs" <gibbs@scsiguy.com> To: John Baldwin <jhb@FreeBSD.org> Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_intr.c src/sys/sys interrupt.h Message-ID: <200103041812.f24ICoO80977@aslan.scsiguy.com> In-Reply-To: Your message of "Sat, 03 Mar 2001 17:32:51 PST." <XFMail.010303173251.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
>When an interrupt handler is removed, we mark the handler as dead if the thread >is runnable. We do this with a spin lock held to prevent new interrupts from >coming in while we do this. If the thread is runnable, then on a UP system >the ithread isn't running. When the ithread wakes up, it has either already >run the handler (in which case we don't care), it is running the handler, or it >is about to run the handler. If it is about to run the handler, then we will >see the IH_DEAD flag and remove the handler. If it is in the handler, there's >nothing we can really do. Sure there is. You can block the "releaser" until the interrupt routine exits. There is no other way to resolve the race condition. Since registering and de-registering interrupt handlers should be an uncommon occurance, it would be nice to avoid having to have a spin-lock acquired just to protect the list of handlers serviced by the ithread that needs to be acquired every time it is placed in the run state. Perhaps you should just change the handler's entry point to the removal function and set the ithread runable. The new entry point would remove the handler and wakeup the thread waiting for the entry to be removed. Something very similar could be used to add new entries onto the queue so long as the ithread's list of handlers has a sentinal node that usually is NULL. -- Justin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103041812.f24ICoO80977>