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

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>
  • 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
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • 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. :)
Xen-devel mailing list



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