aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorDirk Brandewie <dirk.j.brandewie@intel.com>2014-05-29 12:32:22 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-02 06:44:48 -0400
commitadacdf3f2b8e65aa441613cf61c4f598e9042690 (patch)
tree53280f5d401216f8d949b42eabc06433c79065d6 /drivers/cpufreq
parentfad01e866afdbe01a1f3ec06a39c3a8b9e197014 (diff)
intel_pstate: Remove C0 tracking
Commit fcb6a15c (intel_pstate: Take core C0 time into account for core busy calculation) introduced a regression referenced below. The issue with "lockup" after suspend that this commit was addressing is now dealt with in the suspend path. Fixes: fcb6a15c2e7e (intel_pstate: Take core C0 time into account for core busy calculation) Link: https://bugzilla.kernel.org/show_bug.cgi?id=66581 Link: https://bugzilla.kernel.org/show_bug.cgi?id=75121 Reported-by: Doug Smythies <dsmythies@telus.net> Cc: 3.14+ <stable@vger.kernel.org> # 3.14+ Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/intel_pstate.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index eab8ccfe6beb..e5735446c7ed 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -59,7 +59,6 @@ struct sample {
59 int32_t core_pct_busy; 59 int32_t core_pct_busy;
60 u64 aperf; 60 u64 aperf;
61 u64 mperf; 61 u64 mperf;
62 unsigned long long tsc;
63 int freq; 62 int freq;
64}; 63};
65 64
@@ -100,7 +99,6 @@ struct cpudata {
100 99
101 u64 prev_aperf; 100 u64 prev_aperf;
102 u64 prev_mperf; 101 u64 prev_mperf;
103 unsigned long long prev_tsc;
104 struct sample sample; 102 struct sample sample;
105}; 103};
106 104
@@ -561,46 +559,37 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu,
561 struct sample *sample) 559 struct sample *sample)
562{ 560{
563 int32_t core_pct; 561 int32_t core_pct;
564 int32_t c0_pct;
565 562
566 core_pct = div_fp(int_tofp((sample->aperf)), 563 core_pct = div_fp(int_tofp((sample->aperf)),
567 int_tofp((sample->mperf))); 564 int_tofp((sample->mperf)));
568 core_pct = mul_fp(core_pct, int_tofp(100)); 565 core_pct = mul_fp(core_pct, int_tofp(100));
569 FP_ROUNDUP(core_pct); 566 FP_ROUNDUP(core_pct);
570 567
571 c0_pct = div_fp(int_tofp(sample->mperf), int_tofp(sample->tsc));
572
573 sample->freq = fp_toint( 568 sample->freq = fp_toint(
574 mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct)); 569 mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct));
575 570
576 sample->core_pct_busy = mul_fp(core_pct, c0_pct); 571 sample->core_pct_busy = core_pct;
577} 572}
578 573
579static inline void intel_pstate_sample(struct cpudata *cpu) 574static inline void intel_pstate_sample(struct cpudata *cpu)
580{ 575{
581 u64 aperf, mperf; 576 u64 aperf, mperf;
582 unsigned long long tsc;
583 577
584 rdmsrl(MSR_IA32_APERF, aperf); 578 rdmsrl(MSR_IA32_APERF, aperf);
585 rdmsrl(MSR_IA32_MPERF, mperf); 579 rdmsrl(MSR_IA32_MPERF, mperf);
586 tsc = native_read_tsc();
587 580
588 aperf = aperf >> FRAC_BITS; 581 aperf = aperf >> FRAC_BITS;
589 mperf = mperf >> FRAC_BITS; 582 mperf = mperf >> FRAC_BITS;
590 tsc = tsc >> FRAC_BITS;
591 583
592 cpu->sample.aperf = aperf; 584 cpu->sample.aperf = aperf;
593 cpu->sample.mperf = mperf; 585 cpu->sample.mperf = mperf;
594 cpu->sample.tsc = tsc;
595 cpu->sample.aperf -= cpu->prev_aperf; 586 cpu->sample.aperf -= cpu->prev_aperf;
596 cpu->sample.mperf -= cpu->prev_mperf; 587 cpu->sample.mperf -= cpu->prev_mperf;
597 cpu->sample.tsc -= cpu->prev_tsc;
598 588
599 intel_pstate_calc_busy(cpu, &cpu->sample); 589 intel_pstate_calc_busy(cpu, &cpu->sample);
600 590
601 cpu->prev_aperf = aperf; 591 cpu->prev_aperf = aperf;
602 cpu->prev_mperf = mperf; 592 cpu->prev_mperf = mperf;
603 cpu->prev_tsc = tsc;
604} 593}
605 594
606static inline void intel_pstate_set_sample_time(struct cpudata *cpu) 595static inline void intel_pstate_set_sample_time(struct cpudata *cpu)