From owner-freebsd-smp Sun Apr 5 06:10:39 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA16675 for freebsd-smp-outgoing; Sun, 5 Apr 1998 06:10:39 -0700 (PDT) (envelope-from owner-freebsd-smp@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA16669 for ; Sun, 5 Apr 1998 06:10:35 -0700 (PDT) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id XAA05313; Sun, 5 Apr 1998 23:06:05 +1000 Date: Sun, 5 Apr 1998 23:06:05 +1000 From: Bruce Evans Message-Id: <199804051306.XAA05313@godzilla.zeta.org.au> To: bde@zeta.org.au, phk@critter.freebsd.dk Subject: Re: more SMP stuff Cc: peter@netplex.com.au, smp@FreeBSD.ORG Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >>The scaling needs to be more robust since the h/w counter might be >>slower than 10^6 hz. > >No, that is a design decision. Timecounter must be >= 1MHz. Why? The i8254 is only marginally faster than 1MHz. There's no reason to expect a faster clock unless the CPU clock can be read. >>>This isn't it anyway, the dummy counter is only used by syscons >>>screensaver calls to getmicroruntime(); >> >>It's used by my version of the floppy driver which calls microtime() >>to timestamp certain events. > >before the i8254 is initialized ? In fdprobe(), before the i8254 is completely initialized. >>I don't think I call nanotime() so early. My rtcintr() calls >>nanotime() to gather statistics, and nanotime() was reentered. >>I don't see any reentrancy problems. There will be one when >>nanotime updates tc->nanotime like it should. > >No it shouldn't, I'm sorry but I cannot find a way where that makes >fewer problems than it fixes... It is essential for POSIX.1 conformance and probably for `make' E.g., the following shows chmod()+stat() sometimes updating the ctime of a fifo apparently-before either is called. (POSIX.1 doesn't have gettimeofday(); this example uses it just to find a bad time and to show how close to the bad time we managed to do the chmod(). argv[1] can be set to a small integer to manually search for the window of bad times.) --- #include #include int main(int argc, char **argv) { unsigned delay; int try; struct stat sb; struct timeval tv0, tv1, tv2; unlink("f"); mkfifo("f", 0777); delay = argc <= 1 ? 0 : atoi(argv[1]); for (try = 0;; try++) { gettimeofday(&tv0, 0); while (1) { gettimeofday(&tv1, 0); if (tv1.tv_sec != tv0.tv_sec) break; } if (delay != 0) { while (--delay != 0) ; gettimeofday(&tv1, 0); } chmod("f", 0777); stat("f", &sb); gettimeofday(&tv2, 0); if (tv1.tv_sec > sb.st_ctime || tv2.tv_sec < sb.st_ctime) break; } printf("%d: %ld.%06ld %ld %ld.%06ld\n", try, tv1.tv_sec, tv1.tv_usec, sb.st_ctime, tv2.tv_sec, tv2.tv_usec); } --- Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message