欢迎转载,转载请注明出处 http://forever.blog.chinaunix.net
Author: Tony

1.查看系统可用是时钟源
SLES 11 SP2上的时钟源-LMLPHP
2.查看系统当前所用时钟源
SLES 11 SP2上的时钟源-LMLPHP
3.Why tsc?
 看到这里大家可能会有些疑惑了。因为ULK3中说过,80x86架构下,时钟源的优先权顺序是:
timer_hpet > timer_pmtmr > timer_tsc > timer_pit > timer_none

根据这个优先权顺序的话,应该选择hpet时钟源,不应该选择可能受CPU工作频率、工作电压等影响的tsc时钟源。
我们先从内核代码中查找原因:
SLES 11 SP2上的时钟源-LMLPHP
SLES 11 SP2上的时钟源-LMLPHP

从代码来看,tsc的rating要大于hpet,的确是应该选择tsc的。那ULK3中提到的问题是怎么回事?

4. About tsc.
  TSC的性能要好于HPET:(http://www.chromium.org/chromium-os/how-tos-and-troubleshooting/tsc-resynchronization)
    TSC access is extremly fast as it is a per CPU register. HPET is a chipset device and scales bad when multiple CPUs try to access it simultanously as the access is serialized in hardware. Even on a UP system the access overhead is somewhere in the range of factor 100. 
  TSC主要有4种:
    Constant. Constant TSC means that the TSC does not change with CPU frequency changes, however it does change on C state transitions.
    Invariant. As described in the Intel manual: “The invariant TSC will run at a constant rate in all ACPI P-, C- and T-states”
    Non-stop. The Non-stop TSC has the properties of both Constant and Invariant TSC.
    None of the above. The TSC changes with the C, P and S state transitions
  并不是所有的TSC都可用:
    we only use the TSC, when: 
        - the TSC is known to be stable (not affected by CPU frequency changes) 
        - the TSC is sychronized accross CPUs 
    We also check the TSC with a watchdog mechanism, which verifies that is is keeping accurate time. When we detect that TSC does not, we replace it by the next available clock source.
10-12 06:21
查看更多