[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4AC1C557.2050002@redhat.com>
Date: Tue, 29 Sep 2009 10:29:11 +0200
From: Avi Kivity <avi@...hat.com>
To: Zachary Amsden <zamsden@...hat.com>
CC: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Marcelo Tosatti <mtosatti@...hat.com>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists