Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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

authored by

Nagananda.Chumbalkar@hp.com and committed by
Dave Jones
1dbf5888 557a701c

+3
+3
drivers/cpufreq/cpufreq_ondemand.c
··· 554 554 (dbs_tuners_ins.up_threshold - 555 555 dbs_tuners_ins.down_differential); 556 556 557 + if (freq_next < policy->min) 558 + freq_next = policy->min; 559 + 557 560 if (!dbs_tuners_ins.powersave_bias) { 558 561 __cpufreq_driver_target(policy, freq_next, 559 562 CPUFREQ_RELATION_L);