NetBSD/dist/ntp/html/hints/solaris.html

144 lines
5.2 KiB
HTML

<HTML>
<HEAD>
<TITLE>Solaris hints and kinks</TITLE>
</HEAD>
<BODY>
Information on compiling and executing ntpd under Solaris.
<BR>
Last Updated: Sun Jun 21 01:32:18 EDT 1998,
John Hawkinson,
<! -- This is deliberately not a mailto -- > &lt;jhawk@MIT.EDU&gt;
<P>
If you're not running Solaris 2.5.1 or later, it is likely
that you will have problems; upgrading would be a really good plan.
<P>
<H3>All Solaris versions</H3>
<P>
We have a report that says starting with Solaris 2.6 we should leave
<I>dosynctodr</I> alone.
<A HREF="solaris-dosynctodr.html">Here is the report</A>.
<P>
Proper operation of ntp under Solaris may require setting the kernel
variable <I>dosynctodr</I> to zero (meaning "do not synchronize the clock
to the hardware time-of-day clock"). This can be done with the
tickadj utility:
<BLOCKQUOTE><TT>
tickadj -s
</TT></BLOCKQUOTE>
If you prefer, it can also be done with the native Solaris kernel debugger:
<BLOCKQUOTE><TT>
echo dosynctodr/W0 | adb -k -w /dev/ksyms /dev/mem
</BLOCKQUOTE></TT>
<P>
Or, it can also be set by adding a line to /etc/system:
<BLOCKQUOTE><TT>
set dosynctodr = 0
</BLOCKQUOTE></TT>
<P>
Instead of the <I>tick</I> kernel variable, which many operating
systems use to control microseconds added to the system time every
clock tick (c.f. <A HREF="../notes.htm#frequency_tolerance">Dealing
with Frequency Tolerance Violations</A>), Solaris has the variables
<I>nsec_per_tick</I> and <I>usec_per_tick</I>.
<P>
<I>nsec_per_tick</I> and <I>usec_per_tick</I> control the number of
nanoseconds and microseconds, respectively, added to the system clock
each clock interrupt. Enterprising souls may set these based on
information collected by ntpd in the <CODE>/etc/ntp.drift</CODE> file
to correct for individual hardware variations.
<P>
On UltraSPARC systems, <I>nsec_per_tick</I> and <I>usec_per_tick</I>
are ignored in favor of the <I>cpu_tick_freq</I> variable, which
should be automatically be determined by the PROM in an accurate
fashion.
<P>
In general, the same ntp binaries should not be used across multiple
operating system releases. There is enough variation in the core operating
system support for timekeeping that a rebuild of ntpd for the idiosyncracies
of your specific operating system version is advisable.
<P>
It is recommended that ntp be started via a script like <A
HREF="solaris.xtra.S99ntpd">this one</A>, installed in
<CODE>/etc/init.d/ntpd</CODE> with a symbol link from
<CODE>/etc/rc2.d/S99ntpd</CODE>.
<H3>Solaris 2.6</H3>
<P>
Solaris 2.6 adds support for kernel PLL timekeeping, but breaks this
support in such a fashion that using it worse than not. This is <A
HREF="solaris.xtra.4095849"> SUN Bug ID 4095849</A>, and it is not yet
fixed as of June 1998.
<P>
<H3>Solaris 2.5 and 2.5.1</H3>
<P>
On UltraSPARC systems, calculation of <I>cpu_tick_freq</I> is broken
such that values that are off by significant amounts may be used
instead. This unfortunately means that ntpd may have severe problems
keeping synchronization. This is <A HREF="solaris.xtra.4023118"> SUN Bug ID
4023118</A>. Bryan Cantrill <! -- &lt;bmc@eng.sun.com&gt; --> of Sun
posted <A HREF="solaris.xtra.patchfreq">patchfreq</A>, a workaround script,
to comp.protocols.time.ntp in March of 1997.
<P>
<HR>
<H2>OLD DATA</H2>
<STRONG>I can't vouch for the accuracy the information below this
rule. It may be significantly dated or incorrect.</STRONG>
<P>
<P>
<H3>Solaris 2.2</H3>
<P>
Solaris 2.2 and later contain completely re-written clock code to
provide high resolution microsecond timers. A benefit of the
re-written clock code is that adjtime does not round off its
adjustments, so ntp does not have to compensate for this
rounding. Under Solaris 2.2 and later, ntp #define's
<CODE>ADJTIME_IS_ACCURATE</CODE>, and does not look for the <I>tickadj</I>
kernel variable.
<P>
<H3>Solaris 2.1</H3>
(This originally written by William L. Jones &lt;jones@chpc.utexas.edu&gt;)
<P>
Solaris 2.1 contains fairly traditional clock code, with <I>tick</I>
and <I>tickadj</I>.
<P>
Since settimeofday under Solaris 2.1 only sets the seconds part of timeval
care must be used in starting xntpd. I suggest the following start
up script:
<BLOCKQUOTE><TT>
tickadj -s -a 1000
<BR>ntpdate -v server1 server2
<BR>sleep 20
<BR>ntpdate -v server1 server2
<BR>sleep 20
<BR>tickadj -a 200
<BR>xntpd
</TT></BLOCKQUOTE>
The first tickadj turns of the time of day clock and sets the tick
adjust value to 1 millisecond. This will insure that an adjtime value
of at most 2 seconds will complete in 20 seconds.
<P>
The first ntpdate will set the time to within two seconds
using settimeofday or it will adjust time using adjtime.
<P>
The first sleep insures the adjtime has completed for the first ntpdate.
<P>
The second ntpdate will use adjtime to set the time of day since the
clock should be within 2 seconds of the correct time.
<P>
The second tickadj set the tick adjust system value to 5 microseconds.
<P>
The second sleeps insure that adjtime will complete before starting
the next xntpd.
<P>
I tried running with a tickadj of 5 microseconds with out much success.
200 microseconds seems to work well.
<P>
<HR>
Prior versions of this file had major text contributed by:
<MENU>
<LI>Denny Gentry &lt;denny@eng.sun.com&gt;
</MENU>
<BODY>
</HTML>