From: george anzinger <george@mvista.com>
To: Kasper Dupont <kasperd@daimi.au.dk>
Cc: Lincoln Dale <ltd@cisco.com>, Linux <linux-kernel@vger.kernel.org>
Subject: Re: HZ, preferably as small as possible
Date: Thu, 11 Jul 2002 11:51:20 -0700 [thread overview]
Message-ID: <3D2DD3A8.74392EC5@mvista.com> (raw)
In-Reply-To: 3D2D6D9C.CA7A17FC@daimi.au.dk
Kasper Dupont wrote:
>
> Lincoln Dale wrote:
> >
> > (or a highly-accurate single-fire timer)?
>
> That would be my preference, at least on hardware where it can
> be done efficient and accurate.
>
> The x86 PIT can be programmed in one-shot mode, but the delay
> cannot be programmed to be more than approximately 55msec. For
> longer delays we'd have to get interrupted prematurely just
> to reprogram the PIT for another delay. This is of course no
> worse than an interrupt every 1 or 10 msec we actually don't
> need.
>
> Another problem is that a PIT in one shot mode cannot meassure
> time accurately. Each interrupt will arrive slightly off the
> wanted time. For the interrupt itself this is no big deal, but
> for meassuring time they will accumulate, so you'd see a clock
> drifting beyond anything acceptable.
>
> The answer here is that we need something else for meassuring
> time, I guess the TSC would be appropriate. If doing all clock
> meassurements using the TSC the clock would no longer drift in
> case of lost timer interrupts. The TSC frequency can be
> meassured at boot time, and if done smart enough that variable
> can be made into a knob that ntpd can control to adjust the
> clock speed instead of a jumping clock once in a while. If we
> are smart enough we can get walltime more accurate than it has
> ever been seen before. :-)
The high-res-timers patch does most of this (all but the ntp
knob). It allows you to use either the TSC or the ACPI pm
timer to keep clock time. The former is fast, but some
systems are known to "mess" with the TSC as part of power
management. The pm timer, being I/O, takes more time to
read, but is not "messed" with.
>
> The problems remaining know are:
> 1) Reprogramming the PIT is slow and inaccurate, we'd like
> better hardware for producing timer interrupts. (I think I
> read somewhere that an APIC could help us here.)
Actually the "best" option would be something like the
decrementer in the PPC. It can be set to generate an
interrupt at just about any time. Another HW register
(64-bits) keeps track of (effectively) decrementer clocks
since boot and can be used as the clock source. The best
solution in the x86 platform, would be an additional
register that either counts down at TSC speed to an
interrupt OR compares to the TSC and interrupts on compare.
It should be a cpu register to avoid the latencies of
accessing an I/O register.
> 2) We will be meassuring time in a lot of different units,
> which needs to be converted. The PIT using 1/1193180 sec,
> the TSC using a varying unit, and finally the user/kernel
> interface using secs, msecs, usecs, nsecs.
Not really a big problem. The conversion constants are
computed once (or at ntp correction) and from then on all
one does is mpy and shift instructions to do the
conversion. (Again, see the HRT patch.)
> 3) On SMP hardware we will be using different TSCs on
> different CPUs. Having TSCs in sync might get more imporant
> than on current kernels.
> 4) We are introducing new hardware requirements.
>
> I'd like to see oneshot timer interrupts as a compile time
> option on any architecture that is capable of doing it. But of
> course it is not easy.
As I imply above, the one shot, if done as an I/O device, is
less than optimal. Better is the PPC decrementer.
>
> Have I missed something somewhere?
>
--
George Anzinger george@mvista.com
High-res-timers:
http://sourceforge.net/projects/high-res-timers/
Real time sched: http://sourceforge.net/projects/rtsched/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml
next prev parent reply other threads:[~2002-07-11 18:49 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-10 19:59 HZ, preferably as small as possible Grover, Andrew
2002-07-10 21:09 ` george anzinger
2002-07-11 6:03 ` Hannu Savolainen
2002-07-11 7:15 ` george anzinger
2002-07-12 0:36 ` Stevie O
2002-07-12 0:50 ` Thunder from the hill
2002-07-12 0:55 ` Robert Love
2002-07-12 0:58 ` Thunder from the hill
2002-07-12 1:24 ` Alan Cox
2002-07-12 1:37 ` Mark Hahn
2002-07-12 1:09 ` george anzinger
2002-07-12 1:26 ` Roland Dreier
2002-07-12 17:30 ` george anzinger
2002-07-12 1:35 ` Stevie O
2002-07-12 3:01 ` Bernd Eckenfels
2002-07-11 12:54 ` Thunder from the hill
2002-07-11 15:59 ` Martin Dalecki
2002-07-10 21:28 ` Andrew Morton
2002-07-10 21:35 ` Benjamin LaHaise
2002-07-10 21:38 ` Andrew Morton
2002-07-10 21:42 ` Benjamin LaHaise
2002-07-11 2:14 ` CaT
2002-07-11 17:01 ` Martin Dalecki
2002-07-10 22:01 ` Thunder from the hill
2002-07-10 22:09 ` Cort Dougan
2002-07-11 13:36 ` Whoa... (was: Re: HZ, preferably as small as possible) Mark Mielke
2002-07-11 21:08 ` Daniel Phillips
2002-07-10 22:41 ` HZ, preferably as small as possible Thunder from the hill
2002-07-10 22:47 ` Thunder from the hill
2002-07-10 22:49 ` Eli Carter
2002-07-10 23:05 ` Thunder from the hill
2002-07-10 23:08 ` Dave Mielke
2002-07-10 23:13 ` Thunder from the hill
2002-07-10 23:50 ` J.A. Magallon
2002-07-11 0:28 ` Lincoln Dale
2002-07-11 11:35 ` Kasper Dupont
2002-07-11 12:30 ` Alan Cox
2002-07-11 13:37 ` Kasper Dupont
2002-07-11 15:46 ` Alan Cox
2002-07-11 18:51 ` george anzinger [this message]
2002-07-15 5:06 ` Linus Torvalds
2002-07-15 16:26 ` Robert Love
2002-07-15 18:56 ` Linus Torvalds
2002-07-15 19:52 ` mbs
2002-07-15 20:01 ` yodaiken
2002-07-16 11:41 ` Vojtech Pavlik
2002-07-17 19:33 ` Daniel Phillips
2002-07-17 20:31 ` Richard B. Johnson
2002-07-17 20:40 ` Daniel Phillips
2002-07-17 21:02 ` Richard B. Johnson
2002-07-17 21:02 ` Linus Torvalds
2002-07-17 21:16 ` Daniel Phillips
2002-07-18 12:57 ` Richard B. Johnson
2002-07-18 13:25 ` Daniel Phillips
2002-07-18 10:10 ` Kai Henningsen
2002-07-17 20:55 ` Linus Torvalds
-- strict thread matches above, loose matches on Subject: below --
2002-07-11 2:46 Grover, Andrew
2002-07-11 3:01 ` Jeff Garzik
2002-07-11 11:45 ` Alan Cox
2002-07-11 17:08 ` Martin Dalecki
2002-07-11 19:21 ` Albert D. Cahalan
2002-07-16 9:17 ` Kai Henningsen
2002-07-11 20:34 ` Bill Davidsen
2002-07-12 12:01 ` Martin Dalecki
2002-07-15 5:15 ` Linus Torvalds
2002-07-15 6:56 ` Albert D. Cahalan
2002-07-15 8:24 ` Russell King
2002-07-15 15:48 ` David Mosberger
2002-07-15 18:20 ` Albert D. Cahalan
2002-07-15 18:30 ` David Mosberger
2002-07-15 16:07 ` Albert D. Cahalan
2002-07-15 17:06 ` Russell King
2002-07-15 18:43 ` Albert D. Cahalan
2002-07-15 18:53 ` Russell King
2002-07-15 18:50 ` Linus Torvalds
2002-07-15 20:15 ` Albert D. Cahalan
2002-07-15 8:58 ` Dave Mielke
2002-07-11 7:09 ` 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=3D2DD3A8.74392EC5@mvista.com \
--to=george@mvista.com \
--cc=kasperd@daimi.au.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=ltd@cisco.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox