• Z
    KVM: Kill the confusing tsc_ref_khz and ref_freq variables · 0cca7907
    Zachary Amsden 提交于
    They are globals, not clearly protected by any ordering or locking, and
    vulnerable to various startup races.
    
    Instead, for variable TSC machines, register the cpufreq notifier and get
    the TSC frequency directly from the cpufreq machinery.  Not only is it
    always right, it is also perfectly accurate, as no error prone measurement
    is required.
    
    On such machines, when a new CPU online is brought online, it isn't clear what
    frequency it will start with, and it may not correspond to the reference, thus
    in hardware_enable we clear the cpu_tsc_khz variable to zero and make sure
    it is set before running on a VCPU.
    Signed-off-by: NZachary Amsden <zamsden@redhat.com>
    Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
    0cca7907
x86.c 119.8 KB