From owner-freebsd-hackers Mon Feb 18 12:51:29 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by hub.freebsd.org (Postfix) with ESMTP id 3964F37B405; Mon, 18 Feb 2002 12:51:23 -0800 (PST) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.6/8.11.6) with ESMTP id g1IKmJN45880; Mon, 18 Feb 2002 21:48:19 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Matthew Dillon Cc: Mike Smith , John Polstra , hackers@FreeBSD.ORG Subject: Re: ACPI timecounter tests original fast version vs masked version In-Reply-To: Your message of "Mon, 18 Feb 2002 12:40:59 PST." <200202182040.g1IKex936264@apollo.backplane.com> Date: Mon, 18 Feb 2002 21:48:18 +0100 Message-ID: <45878.1014065298@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <200202182040.g1IKex936264@apollo.backplane.com>, Matthew Dillon wri tes: > In anycase, I think this is reasonable especially if we explicitly > use the fast code for those chipsets known to be good. I would like > to commit it. It can handle *ANY* sort of ripple or fast-carry breakage, > really any type of breakage since it looks for two identical samples > after masking rather then using an inequality. My only worry here is laptops. If my laptop is connected to the wall-power when it boots it comes up at full CPU speed during the probe and mask determination. Then I unplug it and the CPU speed drops by a large factor and suddenly the mask is too tight for the CPU to get two samples. I think we need an approach where we loosen the mask at runtime if some significant number of iterations fail to get a count may be needed: #define N 25 static unsigned mask = 0xfffffffe; for (;;) { for (i = 0; i < N; i++) { c = READ_TIMER & mask; d = READ_TIMER & mask; if (c == d) return(d); } printf("Adjusting mask to %08x\n", mask); mask <<= 1; } -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message