From owner-freebsd-arch Wed Jan 2 23: 2:24 2002 Delivered-To: freebsd-arch@freebsd.org Received: from niwun.pair.com (niwun.pair.com [209.68.2.70]) by hub.freebsd.org (Postfix) with SMTP id E892837B41B for ; Wed, 2 Jan 2002 23:02:21 -0800 (PST) Received: (qmail 63466 invoked by uid 3193); 3 Jan 2002 07:02:20 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 3 Jan 2002 07:02:20 -0000 Date: Thu, 3 Jan 2002 02:02:20 -0500 (EST) From: Mike Silbersack X-Sender: To: Subject: Re: DELAY accuracy Re: cvs commit: src/sys/dev/usb uhci.c In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 2 Jan 2002, Mike Silbersack wrote: > This commit log started me wondering about DELAY usage in the kernel. > Looking around, we do have a decent amount of such calls. Most of the > calls seem to be for 100 us or less, with some as short a 1 us. These > times seem short, but looking at sys/i386/isa/clock.c, I see that we time > based off the i8254 timer chip, rather than the processor's TSC. As such, > are we actually reaching microsecond accuracy, or is the delay actually > taking longer than expected in many of these cases? > > Thanks, > > Mike "Silby" Silbersack To answer my own question, there seems to be about 8us of slop added to each call to DELAY. This seems irrelevant for calls of 100 or 1000, but changes timing quite a bit on calls between 1 and 10. So, it looks like rewriting DELAY so that it spin-waits on the TSC for delays of less than 100 might be useful. Maybe when I get some time... Mike "Silby" Silbersack To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message