Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jul 1997 18:32:54 +0930 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        Shimon@i-Connect.Net (Simon Shapiro)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: timeout/untimeout - How?
Message-ID:  <199707020902.SAA06766@genesis.atrad.adelaide.edu.au>
In-Reply-To: <XFMail.970702000646.Shimon@i-Connect.Net> from Simon Shapiro at "Jul 2, 97 00:06:46 am"

next in thread | previous in thread | raw e-mail | index | archive | help
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  [[



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