]> bbs.cooldavid.org Git - net-next-2.6.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)
commit0cca790753bf0cab4b070801a46df8e1297c17f6
tree9b2887a5f00872248875ecd001d03e36e425f97a
parentb820cc0ca20fdcf8014d8e57421cf29095e39392
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