From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 20 15:10:12 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C481E16A4CE for ; Sun, 20 Feb 2005 15:10:12 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 17F2B43D41 for ; Sun, 20 Feb 2005 15:10:10 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.11] (junior-wifi.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.1/8.13.1) with ESMTP id j1KFAh1n036388; Sun, 20 Feb 2005 08:10:48 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <4218A7DB.1050705@samsco.org> Date: Sun, 20 Feb 2005 08:08:11 -0700 From: Scott User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050218 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Daniel O'Connor" References: <20050220054251.GB28983@cirb503493.alcatel.com.au> <200502201805.43307.doconnor@gsoft.com.au> In-Reply-To: <200502201805.43307.doconnor@gsoft.com.au> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on pooker.samsco.org cc: freebsd-hackers@freebsd.org cc: Peter Jeremy Subject: Re: Signalling a process from a INTR_FAST handler X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Feb 2005 15:10:12 -0000 Daniel O'Connor wrote: > On Sun, 20 Feb 2005 16:12, Peter Jeremy wrote: > >>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 think you are, and I think the only way to do it is to schedule another > kernel [heavy] thread to do the wakeup. > You can shift the operation off to a fast taskqueue. This assumes that latency between the interrupt and the signal delivery is not critical. Scott