From owner-p4-projects@FreeBSD.ORG Sun Jun 17 02:45:59 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 37D2216A46E; Sun, 17 Jun 2007 02:45:59 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D2F6E16A468; Sun, 17 Jun 2007 02:45:58 +0000 (UTC) (envelope-from rpaulo@fnop.net) Received: from core.fnop.net (mx.fnop.net [82.102.11.82]) by mx1.freebsd.org (Postfix) with ESMTP id 53E3E13C448; Sun, 17 Jun 2007 02:45:58 +0000 (UTC) (envelope-from rpaulo@fnop.net) Received: from core.fnop.net (mx.fnop.net [82.102.11.82]) by core.fnop.net (Postfix) with ESMTP id E47A1690B56; Sun, 17 Jun 2007 03:42:42 +0100 (WEST) Received: by core.fnop.net (Postfix, from userid 1015) id A3914690B62; Sun, 17 Jun 2007 03:42:42 +0100 (WEST) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on core.fnop.net X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DSBL, RCVD_IN_SORBS_DUL autolearn=no version=3.1.7 Received: from epsilon.local.fnop.net (unknown [83.144.140.180]) by core.fnop.net (Postfix) with ESMTP id C37A8690B56; Sun, 17 Jun 2007 03:42:39 +0100 (WEST) Date: Sun, 17 Jun 2007 03:45:47 +0100 Message-ID: <86lkejcn8k.wl%rpaulo@fnop.net> From: Rui Paulo To: "Attilio Rao" In-Reply-To: <3bbf2fe10706081100k4f1457f2g6a714d8c897dc395@mail.gmail.com> References: <200706021756.l52Huq9A049371@repoman.freebsd.org> <86myzeq67f.wl%rpaulo@fnop.net> <4666B730.9080908@FreeBSD.org> <200706081351.54281.jhb@freebsd.org> <3bbf2fe10706081100k4f1457f2g6a714d8c897dc395@mail.gmail.com> User-Agent: Wanderlust/2.15.5 (Almost Unreal) Emacs/21.3 Mule/5.0 (SAKAKI) X-cite-me: rpaulo MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: ClamAV using ClamSMTP Cc: Rui Paulo , Perforce Change Reviews , Rui Paulo , John Baldwin Subject: Re: PERFORCE change 120788 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2007 02:45:59 -0000 At Fri, 8 Jun 2007 20:00:18 +0200, Attilio Rao wrote: > > 2007/6/8, John Baldwin : > > On Wednesday 06 June 2007 09:31:28 am Attilio Rao wrote: > > > Rui Paulo wrote: > > > > > > > > If I'm not doing something wrong, I need to use spin locks on my > > > > interrupt handler, or else witness_checkorder will complain with > > > > "blockable sleep lock". > > > > > > > > Note that I'm using FILTERs. > > > > > > So you are doing this in the wrong way. > > > In order to use correctly filters, please note that the support for them > > > is compile time choosen, so you need to wrapper all filter specific > > > parts using INTR_FILTER compat macro. > > > > Actually, if you only use a filter and not an ithread handler, you can do that > > now w/o needing to have any #ifdef INTR_FILTER stuff. > > In the case your kernel doesn't use filters (!INTR_FILTER) and you > pass a filter, it is automatically mapped to work as a fast handler? Ok, I've looked at sio(4) to see how it was setting up a fast intr handler. Does the following diff look correct? Thanks. ==== //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#13 - /home/rpaulo/p4/rpaulo-macbook/dev/asmc/asmc.c ==== --- /tmp/tmp.96695.67 2007-06-17 03:44:50.000000000 +0100 +++ /home/rpaulo/p4/rpaulo-macbook/dev/asmc/asmc.c 2007-06-17 03:44:17.000000000 +0100 @@ -77,11 +77,8 @@ static int asmc_fan_getvalue(device_t, c static int asmc_temp_getvalue(device_t, const char *); static int asmc_sms_read(device_t, const char *, int16_t *); static void asmc_sms_calibrate(device_t); -#ifdef INTR_FILTER static int asmc_sms_intr(void *); -#else static void asmc_sms_fastintr(void *); -#endif static void asmc_sms_printintr(device_t, uint8_t); /* @@ -236,7 +233,7 @@ static int asmc_attach(device_t dev) { int i, j; - int error; + int ret; char name[2]; struct asmc_softc *sc = device_get_softc(dev); struct asmc_model *model; @@ -378,16 +375,21 @@ asmc_attach(device_t dev) goto out; } -#ifdef INTR_FILTER - error = bus_setup_intr(dev, sc->sc_res, - INTR_TYPE_MISC | INTR_MPSAFE, - asmc_sms_intr, NULL, dev, &sc->sc_cookie); -#else - error = bus_setup_intr(dev, sc->sc_res, - INTR_TYPE_MISC | INTR_MPSAFE | INTR_FAST, - NULL, asmc_sms_fastintr, dev, &sc->sc_cookie); -#endif - if (error) { + ret = bus_setup_intr(dev, sc->sc_res, + INTR_TYPE_MISC | INTR_MPSAFE, + asmc_sms_intr, NULL, dev, &sc->sc_cookie); + + if (ret) { + ret = bus_setup_intr(dev, sc->sc_res, + INTR_TYPE_MISC | INTR_MPSAFE, + NULL, asmc_sms_fastintr, dev, + &sc->sc_cookie); + if (ret == 0) + device_printf(dev, "unable to setup fast interrupt. " + "Using normal mode.\n"); + } + + if (ret) { device_printf(dev, "unable to setup SMS IRQ\n"); bus_release_resource(dev, SYS_RES_IRQ, sc->sc_rid, sc->sc_res); @@ -760,7 +762,6 @@ asmc_sms_calibrate(device_t dev) asmc_sms_read(dev, ASMC_KEY_SMS_Z, &sc->sms_rest_z); } -#ifdef INTR_FILTER static int asmc_sms_intr(void *arg) { @@ -776,7 +777,7 @@ asmc_sms_intr(void *arg) return (FILTER_HANDLED); } -#else + static void asmc_sms_fastintr(void *arg) { @@ -790,7 +791,7 @@ asmc_sms_fastintr(void *arg) asmc_sms_printintr(dev, type); } -#endif /* INTR_FILTER */ + static void asmc_sms_printintr(device_t dev, uint8_t type) -- Rui Paulo