From owner-freebsd-hackers Mon Feb 18 13:36:30 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id D4B8537B404; Mon, 18 Feb 2002 13:36:22 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g1ILaKC42650; Mon, 18 Feb 2002 13:36:20 -0800 (PST) (envelope-from dillon) Date: Mon, 18 Feb 2002 13:36:20 -0800 (PST) From: Matthew Dillon Message-Id: <200202182136.g1ILaKC42650@apollo.backplane.com> To: Poul-Henning Kamp Cc: Mike Smith , John Polstra , hackers@FreeBSD.ORG Subject: Re: ACPI timecounter tests original fast version vs masked version References: <45878.1014065298@critter.freebsd.dk> 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 :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 Ugh. Oh well. So much for the code being simple. I'll incorporate a similar change which adjusts the mask dynamically in both directions. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message