]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Kill the confusing tsc_ref_khz and ref_freq variables
authorZachary Amsden <zamsden@redhat.com>
Tue, 29 Sep 2009 21:38:35 +0000 (11:38 -1000)
committerAvi Kivity <avi@redhat.com>
Thu, 3 Dec 2009 07:32:12 +0000 (09:32 +0200)
commite424aa47ef497f27197ba6176d529cfad3c91b41
tree9b2887a5f00872248875ecd001d03e36e425f97a
parent604f5dc0ee0fd5020625021bf2e47580e9ec705f
KVM: Kill the confusing tsc_ref_khz and ref_freq variables

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: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/x86.c