Messages in this thread | | | Date | Tue, 29 Sep 2009 10:29:11 +0200 | From | Avi Kivity <> | Subject | Re: [PATCH v2: kvm 2/4] Kill the confusing tsc_ref_khz and ref_freq variables. |
| |
On 09/29/2009 06:04 AM, Zachary Amsden wrote: > 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. > > CPUFREQ_TRANSITION_NOTIFIER); > + for_each_online_cpu(cpu) > + per_cpu(cpu_tsc_khz, cpu) = cpufreq_get(cpu); > + } else { > + for_each_possible_cpu(cpu) > + per_cpu(cpu_tsc_khz, cpu) = tsc_khz; > + } > + for_each_possible_cpu(cpu) { > + printk(KERN_DEBUG "kvm: cpu %d = %ld khz\n", > + cpu, per_cpu(cpu_tsc_khz, cpu)); > } > } >
Leftover debug code?
-- error compiling committee.c: too many arguments to function
| |