Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Feb 2005 10:29:16 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        PeterJeremy@optushome.com.au
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Signalling a process from a INTR_FAST handler
Message-ID:  <20050220.102916.39467732.imp@bsdimp.com>
In-Reply-To: <20050220054251.GB28983@cirb503493.alcatel.com.au>
References:  <20050220054251.GB28983@cirb503493.alcatel.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20050220054251.GB28983@cirb503493.alcatel.com.au>
            Peter Jeremy <PeterJeremy@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



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