Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Mar 2001 13:38:51 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        "Justin T. Gibbs" <gibbs@scsiguy.com>
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:  <XFMail.010306133851.jhb@FreeBSD.org>
In-Reply-To: <200103062100.f26L0PO08347@aslan.scsiguy.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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 <jhb@FreeBSD.org> -- 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010306133851.jhb>