Signalling a process from a INTR_FAST handler
M. Warner Losh
imp at bsdimp.com
Sun Feb 20 09:31:55 PST 2005
In message: <20050220054251.GB28983 at cirb503493.alcatel.com.au>
Peter Jeremy <PeterJeremy at optushome.com.au> writes:
: I have a hardware interrupt handler that has to forward a signal to
: userland and that I'd like to mark INTR_FAST. AFAIK, the normal way
: to forward a signal is:
: if ((p = pfind(sc->pid_to_signal)) != NULL) {
: psignal(p, SIGUSR2);
: PROC_UNLOCK(p);
: }
:
: But pfind(9) does a PROC_LOCK() which implies it can sleep and therefore
: can't be used by an INTR_FAST handler.
:
: Firstly, am I correct? If so, is there an alternative approach I can use?
I've been storing td->td_proc in my softc and using that to signal the
process. However, I don't know if you can call psignal without the
process being locked... Hmmm, the big 'PROC_LOCK_ASSERT()' says that
you can't. And the routines that psignal calls also do the
PROC_LOCK_ASSERT... You may be stuck using some kind of helper
mechanism to accomplish this (wakeup another thread and send the
signal from there, there are many variations on this theme).
Warner
More information about the freebsd-hackers
mailing list