From: "Oleg I. Vdovikin" <vdovikin@jscc.ru>
To: "Ivan Kokshaysky" <ink@jurassic.park.msu.ru>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [patch] Re: alpha - generic_init_pit - why using RTC for calibration?
Date: Fri, 6 Jul 2001 13:03:38 +0400 [thread overview]
Message-ID: <005601c105fa$8be41cb0$4d28d0c3@jscc.ru> (raw)
In-Reply-To: <022901c10095$f4fca650$4d28d0c3@jscc.ru> <20010629211931.A582@jurassic.park.msu.ru> <20010704114530.A1030@twiddle.net> <003e01c10522$1c9cf580$4d28d0c3@jscc.ru> <20010705134306.A2071@jurassic.park.msu.ru>
> With both variants even on a 166MHz CPU you'll get above 1e-7 precision,
> which is way above accuracy of any crystal oscillator.
No, this is not so - this line
return ((long)cc * 1000000) / CALIBRATE_TIME;
truncates the result to the MHZ because of the '* 1000000' statement (cc
is an int value, so you just loose the precision). This works ok for x86,
because x86 uses this value with an accuracy to MHz, but this is not enough
for Alphas (see gettimeofday - we're relies rpcc for calculation). Try to
pass 'cycle=666000000' to your kernel and when run ntp - you're out of luck
for clock sync.
But the most innacuracy comes from
#define CALIBRATE_TIME (5 * 1000020/HZ)
1000020 != CLOCK_TICK_RATE - why? So, with this stuff we're loosing more
than 100 KHz (again, this ok for x86) ....
>
> > has cc's type changed to 'unsigned int' to prevent problems when rpcc
> > overflows.
>
> The only difference is that you'll have extra 'zap' instruction converting
> 'unsigned int' to 'unsigned long'.
No, this is not so. The problem is with the sign bit of int, so,
(long)(int)0x80000000 != (long)(unsigned int)0x80000000, and
(long)(int)0x80000000 < 0 and you will get negative frequency value (yes we
current boxes we're not overflowing, but let's look for the future). Funny?
;-))
Oleg.
P.S. Ivan, you can reach me by dialing 938-6412 in Moscow.
next prev parent reply other threads:[~2001-07-06 9:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-29 12:20 alpha - generic_init_pit - why using RTC for calibration? Oleg I. Vdovikin
2001-06-29 17:19 ` Ivan Kokshaysky
2001-07-02 9:52 ` Oleg I. Vdovikin
2001-07-03 13:06 ` Oleg I. Vdovikin
2001-07-04 18:45 ` [patch] " Richard Henderson
2001-07-05 7:14 ` Oleg I. Vdovikin
[not found] ` <3B441618.638A3FC@mandrakesoft.com>
2001-07-05 8:36 ` Oleg I. Vdovikin
2001-07-05 8:47 ` Jeff Garzik
2001-07-06 8:45 ` Oleg I. Vdovikin
2001-07-05 9:43 ` Ivan Kokshaysky
2001-07-06 9:03 ` Oleg I. Vdovikin [this message]
2001-07-06 12:00 ` Ivan Kokshaysky
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='005601c105fa$8be41cb0$4d28d0c3@jscc.ru' \
--to=vdovikin@jscc.ru \
--cc=ink@jurassic.park.msu.ru \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox