From owner-freebsd-hackers Wed Jul 2 02:03:13 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id CAA23448 for hackers-outgoing; Wed, 2 Jul 1997 02:03:13 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id CAA23441 for ; Wed, 2 Jul 1997 02:03:07 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id SAA06766; Wed, 2 Jul 1997 18:32:54 +0930 (CST) From: Michael Smith Message-Id: <199707020902.SAA06766@genesis.atrad.adelaide.edu.au> Subject: Re: timeout/untimeout - How? In-Reply-To: from Simon Shapiro at "Jul 2, 97 00:06:46 am" To: Shimon@i-Connect.Net (Simon Shapiro) Date: Wed, 2 Jul 1997 18:32:54 +0930 (CST) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Simon Shapiro stands accused of saying: [Charset iso-8859-8 unsupported, filtering to ASCII...] > I KNOW I am doing something foolish. But what? > > [at the beginning of a driver] > ... > static void > dpt_timeout_losers(void *dpt); > ... > > [in dpt_scsi_cmd] > ... > ospl = splbio(); > if ( !(dpt->state & DPT_STATE_LOSERS_TIMEOUT_SET) ) { > dpt->state |= DPT_STATE_LOSERS_TIMEOUT_SET; > timeout((timeout_func_t)dpt_timeout_losers, dpt, hz * 10); > } > splx(ospl); > ... > > static void > dpt_timeout_losers(void *arg) > { > dpt_softc_t *dpt = (dpt_softc_t *)arg; > > if ( !(dpt->state & DPT_STATE_LOSERS_TIMEOUT_ACTIVE) ) > dpt_abort_losers(dpt); > > timeout((timeout_func_t)dpt_timeout_losers, (caddr_t)dpt, hz * 10); > } > > What I am trying to do is have the function dpt_abort_losers() run once > every 10 seconds. (Please don't ask why - nasty hardware problems) > > What I am getting is a panic due to timeout table being full. > > Where is my stupidity? At startup, you start one loop of dpt_timeout_losers. Then, every time your code in dpt_scsi_cmd runs, you start another loop. Eventually, you have hundreds or thousands of these loops running, and your timeout table overflows. It's not clear what you actually want from the timeout; do you just want something that runs every 10 seconds and reaps all the losers? If so, don't call your timeout function from dpt_scsi_cmd, because the loop started when the driver is initialised will still be running. > Simon -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[