From owner-cvs-all Wed Apr 10 11:27:36 2002 Delivered-To: cvs-all@freebsd.org Received: from mail.speakeasy.net (mail17.speakeasy.net [216.254.0.217]) by hub.freebsd.org (Postfix) with ESMTP id B8D6637B425 for ; Wed, 10 Apr 2002 11:27:18 -0700 (PDT) Received: (qmail 19519 invoked from network); 10 Apr 2002 18:27:17 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail17.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 10 Apr 2002 18:27:17 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g3AIS2v53537; Wed, 10 Apr 2002 14:28:02 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20020410105203.B209@locore.ca> Date: Wed, 10 Apr 2002 14:27:06 -0400 (EDT) From: John Baldwin To: Jake Burkholder Subject: Re: cvs commit: src/sys/dev/digi digi.c Cc: Brian Somers , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, Bruce Evans Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 10-Apr-2002 Jake Burkholder wrote: > Apparently, On Wed, Apr 10, 2002 at 09:06:18AM -0400, > John Baldwin said words to the effect of; > >> >> On 10-Apr-2002 Bruce Evans wrote: >> > On Tue, 9 Apr 2002, Brian Somers wrote: >> > >> >> brian 2002/04/09 20:13:28 PDT >> >> >> >> Modified files: >> >> sys/dev/digi digi.c >> >> Log: >> >> Add a digi_delay() function and use it instead of tsleep() when polling >> >> the card for command completion. >> >> >> >> digi_delay() uses either tsleep() or DELAY() depending on the value of >> >> ``cold''. >> >> >> >> Pointed in the right direction by: jhb >> > >> > Maybe tsleep() should sleep when cold if given a timeout. This is not >> > quite >> > right, since the semantics of the timeout arg is to give a maximum wait, >> > not a delay, but it is better than ... >> > >> >> >> >> Revision Changes Path >> >> 1.25 +14 -5 src/sys/dev/digi/digi.c >> > >> > N * (+14 -5) in N drivers. All drivers that support dynamic loading need >> > something like this, since busy-waiting on running systems is >> > unacceptable. >> > Not that I will ever want to use this misfeature. >> >> I've thought about having some sort of separate API for code that just ways >> to >> delay. Right now they use tsleep() on a channel that never gets woken up >> with >> a timeout. If we had a delay(int timo) function then it could use a callout >> when callouts were working and fall back to DELAY() in the cold case. > > No, this is wrong. Anything that uses cold is wrong. The correct fix is to > move the clock initialization earlier in boot to be before the device probe. I wouldn't object to doing that but that isn't trivial. I also have a pet peeve about (ab)using tsleep() to do delays but that is a more minor issue. > Jake -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message