[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] Re: [PATCH] CPUIDLE: revise tsc-save/restore to avoid big tsc skew between cpus

On Friday, December 05, 2008 8:36 PM, Keir Fraser wrote:
> It does depend on constant_tsc though. That's fine, but I think then it
> should be implemented as an alternative method selected only when you detect
> constant_tsc at runtime. The fallback should be something like Gang Wei
> posted most recently.
> Also don't use cpu_khz as it's way less accurate than you need to put up
> with. Create a 'struct time_scale' that will convert from nanoseconds to TSC
> ticks. I think a reciprocal function for time_scale's would be useful here
> (and in Gang Wei's last patch as well) as then you can take the existing
> initial TSC->ns scale and flip it.
> The other concern I have is that, even with a much more accurate scale
> factor, CPUs which do not enter deep-C (because they are running busy loops
> for example) will *slowly* wander from the time line determined by your
> scale factor (due to unavoidable imprecision in the scale factor). This
> could build up to be noticeable over days. It might be an idea therefore to
> occasionally force a TSC resync on any CPU that hasn't had it resynced for
> other reasons, just to zap any accumulating imprecision that has crept in.
> It'd only need to be done maybe once a minute or maybe even much less than
> that.

I am updating the original patch for constant_tsc case. There are some 

The first question is, can we just replace the per-second tsc_scale calibration 
with constant tsc_scale & per-second tsc restoring? For constant_tsc, it seems 
meaningless to do the tsc_scale calibration works. And to make the tsc_skew as 
small as possible, it is better to do the tsc resync per-second other than once 
a minute or even less.

The second question is, how can we make a more accruate tsc_scale and use it 
for all local NOW() calculation & tsc restoring? Current initial tsc->ns scale 
is based on PIT, but it is not certain to be the platform timer source. Is it 
practical to make tsc_scale calibration working for seconds and take the 
calibrated tsc_scale as the globle and fixed one?


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.