sst-linux/drivers/cpufreq
Jie Zhan a33ab15c5b cpufreq: governor: Fix negative 'idle_time' handling in dbs_update()
[ Upstream commit 3698dd6b139dc37b35a9ad83d9330c1f99666c02 ]

We observed an issue that the CPU frequency can't raise up with a 100% CPU
load when NOHZ is off and the 'conservative' governor is selected.

'idle_time' can be negative if it's obtained from get_cpu_idle_time_jiffy()
when NOHZ is off.  This was found and explained in commit 9485e4ca0b
("cpufreq: governor: Fix handling of special cases in dbs_update()").

However, commit 7592019634 ("cpufreq: governors: Fix long idle detection
logic in load calculation") introduced a comparison between 'idle_time' and
'samling_rate' to detect a long idle interval.  While 'idle_time' is
converted to int before comparison, it's actually promoted to unsigned
again when compared with an unsigned 'sampling_rate'.  Hence, this leads to
wrong idle interval detection when it's in fact 100% busy and sets
policy_dbs->idle_periods to a very large value.  'conservative' adjusts the
frequency to minimum because of the large 'idle_periods', such that the
frequency can't raise up.  'Ondemand' doesn't use policy_dbs->idle_periods
so it fortunately avoids the issue.

Correct negative 'idle_time' to 0 before any use of it in dbs_update().

Fixes: 7592019634 ("cpufreq: governors: Fix long idle detection logic in load calculation")
Signed-off-by: Jie Zhan <zhanjie9@hisilicon.com>
Reviewed-by: Chen Yu <yu.c.chen@intel.com>
Link: https://patch.msgid.link/20250213035510.2402076-1-zhanjie9@hisilicon.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-10 14:33:30 +02:00
..
acpi-cpufreq.c cpufreq: ACPI: Fix max-frequency computation 2025-02-21 13:49:04 +01:00
amd_freq_sensitivity.c
amd-pstate-trace.c
amd-pstate-trace.h
amd-pstate-ut.c
amd-pstate.c
armada-8k-cpufreq.c
armada-37xx-cpufreq.c
bmips-cpufreq.c
brcmstb-avs-cpufreq.c
cppc_cpufreq.c cpufreq: CPPC: Fix wrong return value in cppc_get_cpu_power() 2024-12-14 19:53:41 +01:00
cpufreq_conservative.c
cpufreq_governor_attr_set.c
cpufreq_governor.c cpufreq: governor: Fix negative 'idle_time' handling in dbs_update() 2025-04-10 14:33:30 +02:00
cpufreq_governor.h
cpufreq_ondemand.c
cpufreq_ondemand.h
cpufreq_performance.c
cpufreq_powersave.c
cpufreq_stats.c
cpufreq_userspace.c
cpufreq-dt-platdev.c
cpufreq-dt.c
cpufreq-dt.h
cpufreq-nforce2.c
cpufreq.c
davinci-cpufreq.c
e_powersaver.c
elanfreq.c
freq_table.c
gx-suspmod.c
highbank-cpufreq.c
ia64-acpi-cpufreq.c
imx6q-cpufreq.c
imx-cpufreq-dt.c
intel_pstate.c cpufreq: intel_pstate: Make hwp_notify_lock a raw spinlock 2024-10-17 15:22:03 +02:00
Kconfig
Kconfig.arm
Kconfig.powerpc
Kconfig.x86
kirkwood-cpufreq.c
longhaul.c
longhaul.h
longrun.c
loongson1-cpufreq.c
loongson2_cpufreq.c cpufreq: loongson2: Unregister platform_driver on failure 2024-12-14 19:53:36 +01:00
Makefile
maple-cpufreq.c
mediatek-cpufreq-hw.c cpufreq: mediatek-hw: Fix wrong return value in mtk_cpufreq_get_cpu_power() 2024-12-14 19:54:02 +01:00
mediatek-cpufreq.c
mvebu-cpufreq.c
omap-cpufreq.c
p4-clockmod.c
pasemi-cpufreq.c
pcc-cpufreq.c
pmac32-cpufreq.c
pmac64-cpufreq.c
powernow-k6.c
powernow-k7.c
powernow-k7.h
powernow-k8.c
powernow-k8.h
powernv-cpufreq.c
ppc_cbe_cpufreq_pervasive.c
ppc_cbe_cpufreq_pmi.c
ppc_cbe_cpufreq.c
ppc_cbe_cpufreq.h
pxa2xx-cpufreq.c
pxa3xx-cpufreq.c
qcom-cpufreq-hw.c
qcom-cpufreq-nvmem.c cpufreq: qcom-nvmem: fix memory leaks in probe error paths 2024-08-11 12:35:53 +02:00
qoriq-cpufreq.c
raspberrypi-cpufreq.c
s3c24xx-cpufreq-debugfs.c
s3c24xx-cpufreq.c
s3c64xx-cpufreq.c cpufreq: s3c64xx: Fix compilation warning 2025-02-21 13:49:38 +01:00
s3c2410-cpufreq.c
s3c2412-cpufreq.c
s3c2416-cpufreq.c
s3c2440-cpufreq.c
s5pv210-cpufreq.c
sa1100-cpufreq.c
sa1110-cpufreq.c
sc520_freq.c
scmi-cpufreq.c cpufreq: scmi: Avoid overflow of target_freq in fast switch 2024-09-08 07:53:09 +02:00
scpi-cpufreq.c cpufreq: scpi: compare kHz instead of Hz 2025-04-10 14:33:30 +02:00
sh-cpufreq.c
sparc-us2e-cpufreq.c
sparc-us3-cpufreq.c
spear-cpufreq.c
speedstep-centrino.c
speedstep-ich.c
speedstep-lib.c
speedstep-lib.h
speedstep-smi.c
sti-cpufreq.c
sun50i-cpufreq-nvmem.c
tegra20-cpufreq.c
tegra124-cpufreq.c
tegra186-cpufreq.c
tegra194-cpufreq.c
ti-cpufreq.c cpufreq: ti-cpufreq: Introduce quirks to handle syscon fails appropriately 2024-10-17 15:20:40 +02:00
vexpress-spc-cpufreq.c