From: Rafael J. Wysocki Date: Tue, 3 Jun 2014 13:03:27 +0000 (+0200) Subject: Merge back earlier cpufreq material. X-Git-Tag: v3.16-rc1~30^2~5^2~1^2 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=5ece2399181a5abaf42a4cb607463770686778e6;p=~emulex%2Finfiniband.git Merge back earlier cpufreq material. Conflicts: arch/mips/loongson/lemote-2f/clock.c drivers/cpufreq/intel_pstate.c --- 5ece2399181a5abaf42a4cb607463770686778e6 diff --cc drivers/cpufreq/intel_pstate.c index db2e45b4808,bfe4280399b..aebd4572eb6 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@@ -557,20 -539,25 +551,20 @@@ static void intel_pstate_get_cpu_pstate if (pstate_funcs.get_vid) pstate_funcs.get_vid(cpu); - - /* - * goto max pstate so we don't slow up boot if we are built-in if we are - * a module we will take care of it during normal operation - */ - intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); + intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); } - static inline void intel_pstate_calc_busy(struct cpudata *cpu, - struct sample *sample) + static inline void intel_pstate_calc_busy(struct cpudata *cpu) { + struct sample *sample = &cpu->sample; - int32_t core_pct; - int32_t c0_pct; + int64_t core_pct; + int32_t rem; - core_pct = div_fp(int_tofp(sample->aperf), int_tofp(sample->mperf)); - core_pct = mul_fp(core_pct, int_tofp(100)); - FP_ROUNDUP(core_pct); + core_pct = int_tofp(sample->aperf) * int_tofp(100); + core_pct = div_u64_rem(core_pct, int_tofp(sample->mperf), &rem); - c0_pct = div_fp(int_tofp(sample->mperf), int_tofp(sample->tsc)); + if ((rem << 1) >= int_tofp(sample->mperf)) + core_pct += 1; sample->freq = fp_toint( mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct)); @@@ -587,15 -575,17 +581,15 @@@ static inline void intel_pstate_sample( aperf = aperf >> FRAC_BITS; mperf = mperf >> FRAC_BITS; - tsc = tsc >> FRAC_BITS; + cpu->last_sample_time = cpu->sample.time; + cpu->sample.time = ktime_get(); cpu->sample.aperf = aperf; cpu->sample.mperf = mperf; - cpu->sample.tsc = tsc; cpu->sample.aperf -= cpu->prev_aperf; cpu->sample.mperf -= cpu->prev_mperf; - cpu->sample.tsc -= cpu->prev_tsc; - intel_pstate_calc_busy(cpu, &cpu->sample); + intel_pstate_calc_busy(cpu); cpu->prev_aperf = aperf; cpu->prev_mperf = mperf;