From owner-p4-projects@FreeBSD.ORG Mon Jun 18 11:07:30 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 420E416A47D; Mon, 18 Jun 2007 11:07:28 +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 8E12E16A4DA for ; Mon, 18 Jun 2007 11:07:28 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.186]) by mx1.freebsd.org (Postfix) with ESMTP id DE1CD13C44C for ; Mon, 18 Jun 2007 11:07:27 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by mu-out-0910.google.com with SMTP id w9so1724780mue for ; Mon, 18 Jun 2007 04:07:26 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=GKBEDoiuVsKxhWh48O+YnEDQ1ulKe/ef2GoMVY+Y/6eSzDxfAKNoZj7ZXqUpvPTkjwlkAyFmKqB6Lb/gLQU6czaCAKznTJMYyepUR9hHN/WBXBE/xcTflKIaoan2yMlNM8LaJKRY6dJnAVXTi2fC42DAHy79/7c/Cdq4HiN0NsE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=sxyeBsqvLvN+CC8HjPZbYHmV2NWVvJrZ5zEw6PTIgioueXHP3+DwBZIUJ7i1ghIrwM44ExJ6oFgEC5z7NeWqMxGsBqhf8XRCEZ8ObsPJxl/Db8H2qeu6GtuW9iZeioFFcoyPtrr5n87a2IRZlbFgk+pWgjtoHSwxfqF5b05dfWk= Received: by 10.82.100.1 with SMTP id x1mr11014197bub.1182164846553; Mon, 18 Jun 2007 04:07:26 -0700 (PDT) Received: from ?172.31.5.25? ( [89.97.252.178]) by mx.google.com with ESMTP id d26sm177597nfh.2007.06.18.04.07.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 18 Jun 2007 04:07:26 -0700 (PDT) Message-ID: <46766753.3080807@FreeBSD.org> Date: Mon, 18 Jun 2007 13:06:59 +0200 From: Attilio Rao User-Agent: Thunderbird 1.5 (X11/20060526) MIME-Version: 1.0 To: Rui Paulo References: <200706021756.l52Huq9A049371@repoman.freebsd.org> <86myzeq67f.wl%rpaulo@fnop.net> <4666B730.9080908@FreeBSD.org> <200706081351.54281.jhb@freebsd.org> <3bbf2fe10706081100k4f1457f2g6a714d8c897dc395@mail.gmail.com> <86lkejcn8k.wl%rpaulo@fnop.net> In-Reply-To: <86lkejcn8k.wl%rpaulo@fnop.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Attilio Rao Cc: 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 Reply-To: attilio@FreeBSD.org List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2007 11:07:30 -0000 Rui Paulo wrote: > 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); Generally, I don't like much the if (ret == 0) device_printf() since you are doing a probe-by-try and so it should not display in this way IMHO. Maybe having it under some debugging mechanism (e.g. KTR and similar) would be acceptable. My 2 cents. Attilio