From owner-p4-projects@FreeBSD.ORG Tue Nov 29 05:26:15 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2018216A422; Tue, 29 Nov 2005 05:26:15 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC7BF16A41F; Tue, 29 Nov 2005 05:26:14 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.FreeBSD.org (Postfix) with ESMTP id DFDDD43D4C; Tue, 29 Nov 2005 05:26:13 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.5b3) with ESMTP id 2781190 for multiple; Tue, 29 Nov 2005 00:26:23 -0500 Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.1/8.13.1) with ESMTP id jAT5Q64T067237; Tue, 29 Nov 2005 00:26:06 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Peter Wemm Date: Tue, 29 Nov 2005 00:22:24 -0500 User-Agent: KMail/1.8.3 References: <200511290118.jAT1I5wD042291@repoman.freebsd.org> In-Reply-To: <200511290118.jAT1I5wD042291@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200511290022.25288.jhb@freebsd.org> X-Spam-Status: No, score=-2.8 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on server.baldwin.cx X-Server: High Performance Mail Server - http://surgemail.com r=1653887525 Cc: Perforce Change Reviews Subject: Re: PERFORCE change 87405 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2005 05:26:16 -0000 On Monday 28 November 2005 08:18 pm, Peter Wemm wrote: > http://perforce.freebsd.org/chv.cgi?CH=3D87405 > > Change 87405 by peter@peter_daintree on 2005/11/29 01:17:18 > > So, there was no need to turn to use 3 files when 1 would do. > > Affected files ... > > .. //depot/projects/hammer/sys/amd64/amd64/tsc.c#13 edit > .. //depot/projects/hammer/sys/amd64/include/clock.h#18 edit > .. //depot/projects/hammer/sys/amd64/isa/clock.c#51 edit > > Differences ... > > =3D=3D=3D=3D //depot/projects/hammer/sys/amd64/amd64/tsc.c#13 (text+ko) = =3D=3D=3D=3D > > @@ -128,15 +128,3 @@ > { > return (rdtsc()); > } > - > -void > -tsc_DELAY(int n) > -{ > - uint64_t start, end, now; > - > - start =3D rdtsc(); > - end =3D start + (tsc_freq * n) / 1000000; > - do { > - now =3D rdtsc(); > - } while (now < end || (now > start && end < start)); > -} > > =3D=3D=3D=3D //depot/projects/hammer/sys/amd64/include/clock.h#18 (text+k= o) =3D=3D=3D=3D > > @@ -37,7 +37,6 @@ > int sysbeep(int pitch, int period); > void init_TSC(void); > void init_TSC_tc(void); > -void tsc_DELAY(int); > > #endif /* _KERNEL */ > > > =3D=3D=3D=3D //depot/projects/hammer/sys/amd64/isa/clock.c#51 (text+ko) = =3D=3D=3D=3D > > @@ -272,7 +272,13 @@ > #endif > > if (tsc_freq !=3D 0 && !tsc_is_broken) { > - tsc_DELAY(n); > + uint64_t start, end, now; > + > + start =3D rdtsc(); > + end =3D start + (tsc_freq * n) / 1000000; > + do { > + now =3D rdtsc(); > + } while (now < end || (now > start && end < start)); > return; > } > #ifdef DELAYDEBUG What happens when you are preempted and migrate to another CPU? Currently= =20 DELAY() doesn't mandate that callers hold a critical section while calling= =20 it. You could do a critical_enter/exit pair here perhaps (note that=20 critical_enter/exit doesn't block interrupts, just ithread preemptions). =2D-=20 John Baldwin =A0<>< =A0http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org