Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Nov 2005 00:22:24 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Peter Wemm <peter@freebsd.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 87405 for review
Message-ID:  <200511290022.25288.jhb@freebsd.org>
In-Reply-To: <200511290118.jAT1I5wD042291@repoman.freebsd.org>
References:  <200511290118.jAT1I5wD042291@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <jhb@FreeBSD.org> =A0<>< =A0http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511290022.25288.jhb>