From: George Anzinger <george@mvista.com>
To: lkml <linux-kernel@vger.kernel.org>, john stultz <johnstul@us.ibm.com>
Subject: Incorrect CLOCK_TICK_RATE in 2.6 kernel
Date: Wed, 24 Aug 2005 17:24:58 -0700 [thread overview]
Message-ID: <430D0FDA.3060201@mvista.com> (raw)
CLOCK_TICK_RATE is used by the kernel to compute LATCH, TICK_NSEC and
tick_nsec. This latter is used to update xtime each tick. TICK_NSEC is
then used to compute (at compile time) the conversion constants needed
to convert to/from jiffies from/to timespec and timeval (and others).
The problem is that, if the timer being used is either Cyclone or HPET,
the wrong CLOCK_TICK_RATE is used. This means that systems using these
interrupt sources will be doing a) incorrect update of xtime and b)
incorrect conversion of jiffies. Since these two values will track each
other this will not be seen by simple gettimeofday();
sleep();gettimeofday() tests, but will be seen as a system clock drift
(without NTP) or with NTP, a somewhat high drift rate (to the point of
loosing sync at HZ=1000).
The fact that the user/ system chooses the clock to use at boot time and
can change the clock after boot means that it is not possible to pin
down CLOCK_TICK_RATE at compile time. However, since the computation of
TICK_NSEC and the conversion constants is rather involved it is clear
that we REALLY do want to compute these at compile time.
The suggested solution is to a) set up a structure with the default
(clock of choice at config time) conversion constants in it at compile
time. Then b) at clock init time, populate the structure with the
proper constants for the given clock. These can be computed at compile
time, but from the correct CLOCK_TICK_RATE for the given clock.
Switching to a fall back clock would also require an update of this
structure.
Commits?
--
George Anzinger george@mvista.com
HRT (High-res-timers): http://sourceforge.net/projects/high-res-timers/
next reply other threads:[~2005-08-25 0:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-25 0:24 George Anzinger [this message]
2005-08-25 0:33 ` Incorrect CLOCK_TICK_RATE in 2.6 kernel john stultz
2005-08-25 1:30 ` George Anzinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=430D0FDA.3060201@mvista.com \
--to=george@mvista.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.