lkml.org 
[lkml]   [2009]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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



\
 
 \ /
  Last update: 2009-09-29 10:31    [W:0.771 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site