History

cpufreq: intel_pstate: Take CPUFREQ_GOV_STRICT_TARGET into account

Make intel_pstate take the new CPUFREQ_GOV_STRICT_TARGET governor flag into account when it operates in the passive mode with HWP enabled, so as to fix the "powersave" governor behavior in that case (currently, HWP is allowed to scale the performance all the way up to the policy max limit when the "powersave" governor is used, but it should be constrained to the policy min limit then).

Rafael J. Wysocki committed 6 years ago

Commit fcb3a1a1 parent ea9364b1 file · +9 −7Browse files

Unified · Split

drivers/cpufreq/intel_pstate.c+9−7
@@ -2527,7 +2527,7 @@ static void intel_cpufreq_trace(struct cpudata *cpu, unsigned int trace_type, in · 2526 unmodified lines
2527}2527}
2528 2528
2529static void intel_cpufreq_adjust_hwp(struct cpudata *cpu, u32 target_pstate,2529static void intel_cpufreq_adjust_hwp(struct cpudata *cpu, u32 target_pstate,
2530 bool fast_switch)2530 bool strict, bool fast_switch)
2531{2531{
2532 u64 prev = READ_ONCE(cpu->hwp_req_cached), value = prev;2532 u64 prev = READ_ONCE(cpu->hwp_req_cached), value = prev;
2533 2533
@@ -2539,7 +2539,7 @@ static void intel_cpufreq_adjust_hwp(struct cpudata *cpu, u32 target_pstate, · 5 unmodified lines
2539 * field in it, so opportunistically update the max too if needed.2539 * field in it, so opportunistically update the max too if needed.
2540 */2540 */
2541 value &= ~HWP_MAX_PERF(~0L);2541 value &= ~HWP_MAX_PERF(~0L);
2542 value |= HWP_MAX_PERF(cpu->max_perf_ratio);2542 value |= HWP_MAX_PERF(strict ? target_pstate : cpu->max_perf_ratio);
2543 2543
2544 if (value == prev)2544 if (value == prev)
2545 return;2545 return;
@@ -2562,14 +2562,16 @@ static void intel_cpufreq_adjust_perf_ctl(struct cpudata *cpu, · 16 unmodified lines
2562 pstate_funcs.get_val(cpu, target_pstate));2562 pstate_funcs.get_val(cpu, target_pstate));
2563}2563}
2564 2564
2565static int intel_cpufreq_update_pstate(struct cpudata *cpu, int target_pstate,2565static int intel_cpufreq_update_pstate(struct cpufreq_policy *policy,
2566 bool fast_switch)2566 int target_pstate, bool fast_switch)
2567{2567{
2568 struct cpudata *cpu = all_cpu_data[policy->cpu];
2568 int old_pstate = cpu->pstate.current_pstate;2569 int old_pstate = cpu->pstate.current_pstate;
2569 2570
2570 target_pstate = intel_pstate_prepare_request(cpu, target_pstate);2571 target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
2571 if (hwp_active) {2572 if (hwp_active) {
2572 intel_cpufreq_adjust_hwp(cpu, target_pstate, fast_switch);2573 intel_cpufreq_adjust_hwp(cpu, target_pstate,
2574 policy->strict_target, fast_switch);
2573 cpu->pstate.current_pstate = target_pstate;2575 cpu->pstate.current_pstate = target_pstate;
2574 } else if (target_pstate != old_pstate) {2576 } else if (target_pstate != old_pstate) {
2575 intel_cpufreq_adjust_perf_ctl(cpu, target_pstate, fast_switch);2577 intel_cpufreq_adjust_perf_ctl(cpu, target_pstate, fast_switch);
@@ -2609,7 +2611,7 @@ static int intel_cpufreq_target(struct cpufreq_policy *policy, · 33 unmodified lines
2609 break;2611 break;
2610 }2612 }
2611 2613
2612 target_pstate = intel_cpufreq_update_pstate(cpu, target_pstate, false);2614 target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, false);
2613 2615
2614 freqs.new = target_pstate * cpu->pstate.scaling;2616 freqs.new = target_pstate * cpu->pstate.scaling;
2615 2617
@@ -2628,7 +2630,7 @@ static unsigned int intel_cpufreq_fast_switch(struct cpufreq_policy *policy, · 12 unmodified lines
2628 2630
2629 target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling);2631 target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling);
2630 2632
2631 target_pstate = intel_cpufreq_update_pstate(cpu, target_pstate, true);2633 target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, true);
2632 2634
2633 return target_pstate * cpu->pstate.scaling;2635 return target_pstate * cpu->pstate.scaling;
2634}2636}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t