|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] Re: tsc_scale/cpu_khz imprecise and need fixing?
On 29/10/2009 20:28, "Dan Magenheimer" <dan.magenheimer@xxxxxxxxxx> wrote:
> I *think* the reason is that tsc_scale, which
> I believe is set only once per processor at startup
> on machines with constant/invariant TSC, is set
> imprecisely using init_pit_and_calibrate_tsc().
> I suspect the imprecision is compounded through
> the reciprocal operation. AND I wonder if an ill-timed
> power management event might render tsc_scale not
> just imprecise, but just plain wrong!
The 50ms calibration period may not be long enough, we could put the PIT in
square-wave mode instead and count 10 50ms periods...
However this may not improve matters since the PIT may tick at quite a
different rate than the stated frequency. A crystal can easily be 100ppm off
from what's stamped on the can. Really we should calibrate the TSC to the
platform timer that we choose to use. Perhaps we should update tsc_scale
even for invariant tsc, just to fold in extra precision after boot. E.g.,
tsc_scale = alpha*old_tsc_scale +
(1-alpha)*(new_sys_time-old_sys_time)/(new_tsc-old_tsc)
and increase alpha towards 1 over time, as we develop trust in the value of
tsc_scale. Where new/old tsc and system-time values would be across a
calibration rendezvous period.
-- Keir
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|