From: Ralf Baechle <ralf@linux-mips.org>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Franck Bui-Huu <vagabon.xyz@gmail.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
linux-mips@linux-mips.org
Subject: Re: [PATCH 3/5] Deforest the function pointer jungle in the time code.
Date: Fri, 15 Jun 2007 14:26:13 +0100 [thread overview]
Message-ID: <20070615132613.GA16133@linux-mips.org> (raw)
In-Reply-To: <Pine.LNX.4.64N.0706151117180.3754@blysk.ds.pg.gda.pl>
On Fri, Jun 15, 2007 at 12:07:05PM +0100, Maciej W. Rozycki wrote:
> > Which other purposes ? CP0 hpt gives generally the highest precision for
> > a given platform, and it seems to be your case too. I don't see which other
> > better purpose it can deserve other than hrtimer, tick interrupt...
>
> One better purpose could be using it as a backend timer for setitimer().
> Or just a general timer device ("/dev/counter") with some operations to
> make use of it. I think there were some ideas quoted on this list.
>
> For real time you do not need a precision of one or two CPU clocks -- it
> will be lost in the overhead of the gettimeofday() syscall, any cache
> activity will flush the precision down the drain, any branch
> unpredictability will ruin it, etc. An actual resolution of 1us will be
> excellent already. Try running `ntpd' on your platform of choice using a
> reasonable time reference source and see how it behaves.
>
> And last but not least for real time you do want to select the source
> that has the best frequency stability and not necessarily the highest
> frequency. For DEC the IOASIC timer has reportedly the best stability and
> was actually used by David L. Mills for his work on `ntpd'. Perhaps the
> temperature around the oscillator used for it changes the least.
> Similarly the Dallas Semiconductor real time clocks have very good
> frequency characteristics (quite unsurprisingly in my opinion).
>
> The issues around timekeeping have been beaten to death on many
> discussion forums -- I guess many of them may be quite easily reached with
> the right keywords and your favourite search engine.
The cp0 timer may have disadvantages but it certainly is the timer with
the lowest overhead to program, usually the timer with the highest
resolution. Unless in the rare cases where cp0 cannot be used because
it cannot trigger interrupts or the CPU clock is variable I think it will
always be the clockevent device of choice.
You still need a decent clocksource and for that one it's much more
important to have something that provides good long term stability. So
if you happen to have a system where the external timer tends to be
superior, by all means go for it. All it takes is to assign it a higher
rating and the kernel will pick it.
> > I don't see how you can have hrtimer support if you choose a periodic
> > timer...
>
> Well, periodic timers do seem to work somehow for everybody else with no
> hassle whatsoever, starting from the DEC code I referred to and including
> other platforms, like the i386, which uses the 8254 for the timer
> interrupt and as a HPT, by default, the very same counter or the TSC in
> the CPU if available or, I think, some chipset timer, because some
> brilliant soul decided to break the TSC at one point.
The tickless kernel needs something that can be used as oneshoot timer.
> Note that the 8254 can be reprogrammed into a one-shot mode, but somehow
> nobody does it. ;-) Similarly for the local APIC timer that is used for
> scheduling on i386 systems (if available).
Actually modern i386 kernels use it in both modes. But this can't help
over the fact that the i8253/i8254 is a horrible chip with extremly slow
access times so it's only used as the fallback when everything else fails.
> See arch/mips/mips-boards/generic/time.c for example. Or any platform
> that uses the CP0 timer interrupt and has a configurable CPU frequency --
> you can find them easily by looking for ones that calculate
> mips_hpt_frequency rather than set it to a fixed value.
For some reason the calibration turned out to be rather trick on Indys, so
arch/mips/sgi-ip22/ip22-time.c's plat_time_init is a well working example
for calibration of the cp0 timer against a timer of know speed.
Ralf
next prev parent reply other threads:[~2007-06-15 13:30 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-14 10:19 [RFD] Time rework [take #2] Franck Bui-Huu
2007-06-14 10:19 ` [PATCH 1/5] Use generic NTP code for all MIPS platforms Franck Bui-Huu
2007-06-14 10:19 ` [PATCH 2/5] Remove unused time.c for swarm Franck Bui-Huu
2007-06-14 10:19 ` [PATCH 3/5] Deforest the function pointer jungle in the time code Franck Bui-Huu
2007-06-14 11:17 ` Thomas Bogendoerfer
2007-06-14 13:43 ` Franck Bui-Huu
2007-06-14 14:09 ` Maciej W. Rozycki
2007-06-14 14:31 ` Franck Bui-Huu
2007-06-14 16:33 ` Maciej W. Rozycki
2007-06-14 16:54 ` Maciej W. Rozycki
2007-06-15 8:59 ` Franck Bui-Huu
2007-06-15 11:07 ` Maciej W. Rozycki
2007-06-15 13:26 ` Ralf Baechle [this message]
2007-06-15 14:08 ` Maciej W. Rozycki
2007-06-15 14:21 ` Ralf Baechle
2007-06-15 14:24 ` Franck Bui-Huu
2007-06-15 14:38 ` Ralf Baechle
2007-06-15 15:34 ` Franck Bui-Huu
2007-06-15 14:35 ` Sergei Shtylyov
2007-06-15 13:49 ` Ralf Baechle
2007-06-15 14:42 ` Sergei Shtylyov
2007-06-17 13:36 ` Franck Bui-Huu
2007-06-17 16:14 ` Atsushi Nemoto
2007-06-18 9:38 ` Franck Bui-Huu
2007-06-18 15:51 ` Atsushi Nemoto
2007-06-19 7:33 ` Franck Bui-Huu
2007-06-19 16:08 ` Atsushi Nemoto
2007-06-19 16:22 ` Sergei Shtylyov
2007-06-19 16:55 ` Franck Bui-Huu
2007-06-19 21:58 ` Ralf Baechle
2007-06-20 10:27 ` Franck Bui-Huu
2007-06-19 17:00 ` Franck Bui-Huu
2007-06-19 17:26 ` Sergei Shtylyov
2007-06-19 17:31 ` Sergei Shtylyov
2007-06-19 19:34 ` Sergei Shtylyov
2007-06-18 12:41 ` Franck Bui-Huu
2007-06-19 19:25 ` Sergei Shtylyov
2007-06-20 10:24 ` Franck Bui-Huu
2007-06-14 15:52 ` Franck Bui-Huu
2007-06-14 16:45 ` Maciej W. Rozycki
2007-06-14 10:20 ` [PATCH 4/5] Consolidate all variants of MIPS cp0 timer interrupt handlers Franck Bui-Huu
2007-06-14 10:20 ` [PATCH 5/5] Implement clockevents for R4000-style cp0 timer Franck Bui-Huu
2007-06-14 12:29 ` Atsushi Nemoto
2007-06-14 13:00 ` Franck Bui-Huu
2007-06-17 0:04 ` Ralf Baechle
2007-06-17 17:23 ` Atsushi Nemoto
2007-06-17 19:25 ` Ralf Baechle
2007-06-18 14:22 ` Franck Bui-Huu
2007-06-18 15:14 ` Ralf Baechle
2007-06-18 15:38 ` Franck Bui-Huu
2007-06-18 15:55 ` Franck Bui-Huu
2007-06-18 16:01 ` Ralf Baechle
2007-06-18 17:42 ` Ralf Baechle
2007-06-18 15:37 ` Ralf Baechle
2007-06-19 17:00 ` Sergei Shtylyov
2007-06-20 8:15 ` Ralf Baechle
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=20070615132613.GA16133@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=linux-mips@linux-mips.org \
--cc=macro@linux-mips.org \
--cc=tsbogend@alpha.franken.de \
--cc=vagabon.xyz@gmail.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 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.