Skip to content

Commit 1dbf588

Browse files
Nagananda.Chumbalkar@hp.comDave Jones
authored andcommitted
[CPUFREQ] Fix ondemand to not request targets outside policy limits
Dominik said: target_freq cannot be below policy->min or above policy->max. If it were, the whole cpufreq subsystem is broken. But (answer): I think the "ondemand" governor can ask for a target frequency that is below policy->min. ... A patch such as below may be needed to sanitize the target frequency requested by "ondemand". The "conservative" governor already has this check: Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dave Jones <davej@redhat.com> # diff -bur x/drivers/cpufreq/cpufreq_ondemand.c.orig y/drivers/cpufreq/cpufreq_ondemand.c
1 parent 557a701 commit 1dbf588

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/cpufreq/cpufreq_ondemand.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,9 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
554554
(dbs_tuners_ins.up_threshold -
555555
dbs_tuners_ins.down_differential);
556556

557+
if (freq_next < policy->min)
558+
freq_next = policy->min;
559+
557560
if (!dbs_tuners_ins.powersave_bias) {
558561
__cpufreq_driver_target(policy, freq_next,
559562
CPUFREQ_RELATION_L);

0 commit comments

Comments
 (0)