WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] Re: tsc_scale/cpu_khz imprecise and need fixing?

To: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, "Xen-Devel (E-mail)" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-devel] Re: tsc_scale/cpu_khz imprecise and need fixing?
From: "Zhang, Xiantao" <xiantao.zhang@xxxxxxxxx>
Date: Fri, 30 Oct 2009 10:04:25 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc:
Delivery-date: Thu, 29 Oct 2009 19:05:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <697dcef8-76aa-4159-87b9-362622b40c77@default>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C70FC41A.18CFC%keir.fraser@xxxxxxxxxxxxx> <697dcef8-76aa-4159-87b9-362622b40c77@default>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcpY66e7n8V81ev5RUaVU4n2ucjJ+QAGKl3A
Thread-topic: [Xen-devel] Re: tsc_scale/cpu_khz imprecise and need fixing?
Dan Magenheimer 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...
> 
> To support this, it appears that the value returned
> by init_pit_and_calibrate_tsc(), which is essentially
> "cpu_hz", varies by about 20K or more from boot to boot
> on the same hardware.

That explains why we use cpu_khz/1000(mHZ) to determin whether needs TSC soft 
scaling for migration between two machines.  That is to say, even if two 
machine's tsc_khz are different in khz unit(calibration result), their real 
frequency maybe same in real world. :)
Xiantao
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel