misc/34596: slow gettimeofday in FreeBSD 4.5

Bruce Evans bde at zeta.org.au
Wed Jun 4 13:50:14 PDT 2003


The following reply was made to PR misc/34596; it has been noted by GNATS.

From: Bruce Evans <bde at zeta.org.au>
To: Andreas Gustafsson <gson at nominum.com>
Cc: freebsd-gnats-submit at freebsd.org
Subject: Re: misc/34596: slow gettimeofday in FreeBSD 4.5
Date: Thu, 5 Jun 2003 06:43:01 +1000 (EST)

 On Wed, 4 Jun 2003, Andreas Gustafsson wrote:
 
 > Bruce Evans writes:
 > > FreeBSD-4.8 should be configured to use the TSC timecounter in the non-SMP
 > > case.
 >
 > Do you mean "should be automatically configured", or "should be
 > configured by the user"?  If the latter, where is this documented?
 
 Both :-).  It seems to be undocumented (except in the source code).
 
 > > Configuration of apm may pessimize the default configuration.  The
 > > TSC is not supported for the !SMP case.
 >
 > When you say "!SMP", do you mean "non-SMP" (which would seem to
 > contradict the above) or "SMP"?
 
 I mean "non-SMP".  The automatic configuration does a reasonable job
 in the non-SMP case unless apm is configured.  Unfortunately, GENERIC
 in RELENG_4 sets a bad example by configuring apm.  It is configured
 as disabled so it is usually not used, but this doesn't help because
 the automatic configuration uses a compile-time test for apm.  Better
 yet, the automatic configuration refuses to register the TSC as a
 timecounter if apm is statically configured, so you can't select the
 TSC timecounter at runtime using "sysctl kern.timecounter=TSC" unless
 you remove apm from the configuration.  These bugs are fixed in -current.
 
 In the SMP case, the TSC timecounter is similarly statically not
 configured, but this is correct since it doesn't work in the SMP
 case.  The automatic configuration uses the best available timecounter,
 but this is too often the i8254 timecounter since there aren't many
 working timecounters to choose from.  In -current, there is also the
 acpi timecounter which works right in more cases (broken cases include
 ones where acpi is broken and some old machines where the acpi timer
 runs at double speed).
 
 Bruce


More information about the freebsd-bugs mailing list