linux/drivers/cpufreq
Rafael J. Wysocki 3000ce3c52 cpufreq: Use per-policy frequency QoS
Replace the CPU device PM QoS used for the management of min and max
frequency constraints in cpufreq (and its users) with per-policy
frequency QoS to avoid problems with cpufreq policies covering
more then one CPU.

Namely, a cpufreq driver is registered with the subsys interface
which calls cpufreq_add_dev() for each CPU, starting from CPU0, so
currently the PM QoS notifiers are added to the first CPU in the
policy (i.e. CPU0 in the majority of cases).

In turn, when the cpufreq driver is unregistered, the subsys interface
doing that calls cpufreq_remove_dev() for each CPU, starting from CPU0,
and the PM QoS notifiers are only removed when cpufreq_remove_dev() is
called for the last CPU in the policy, say CPUx, which as a rule is
not CPU0 if the policy covers more than one CPU.  Then, the PM QoS
notifiers cannot be removed, because CPUx does not have them, and
they are still there in the device PM QoS notifiers list of CPU0,
which prevents new PM QoS notifiers from being registered for CPU0
on the next attempt to register the cpufreq driver.

The same issue occurs when the first CPU in the policy goes offline
before unregistering the driver.

After this change it does not matter which CPU is the policy CPU at
the driver registration time and whether or not it is online all the
time, because the frequency QoS is per policy and not per CPU.

Fixes: 67d874c3b2 ("cpufreq: Register notifiers with the PM QoS framework")
Reported-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Reported-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Diagnosed-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/linux-pm/5ad2624194baa2f53acc1f1e627eb7684c577a19.1562210705.git.viresh.kumar@linaro.org/T/#md2d89e95906b8c91c15f582146173dce2e86e99f
Link: https://lore.kernel.org/linux-pm/20191017094612.6tbkwoq4harsjcqv@vireshk-i7/T/#m30d48cc23b9a80467fbaa16e30f90b3828a5a29b
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
2019-10-21 02:05:21 +02:00
..
acpi-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
amd_freq_sensitivity.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
arm_big_little.c cpufreq: arm_big_little: Register an Energy Model 2019-02-07 09:55:11 +05:30
arm_big_little.h cpufreq: arm_big_little: make function arguments and structure pointer const 2017-11-08 23:22:19 +01:00
armada-8k-cpufreq.c cpufreq: ap806: Add NULL check after kcalloc 2019-07-22 11:12:15 +05:30
armada-37xx-cpufreq.c cpufreq: armada-37xx: Remove set but not used variable 'freq' 2019-06-03 11:26:38 +05:30
bmips-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
brcmstb-avs-cpufreq.c cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency 2019-06-04 09:31:41 +05:30
cppc_cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441 2019-06-05 17:37:17 +02:00
cpufreq_conservative.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_governor_attr_set.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_governor.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_governor.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_ondemand.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_ondemand.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_performance.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_powersave.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_stats.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_userspace.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq-dt-platdev.c Merge branch 'cpufreq/qcom-updates' into cpufreq/arm/linux-next 2019-09-03 07:55:22 +05:30
cpufreq-dt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq-dt.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq-nforce2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
cpufreq.c cpufreq: Use per-policy frequency QoS 2019-10-21 02:05:21 +02:00
davinci-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
e_powersaver.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
elanfreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
freq_table.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
gx-suspmod.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
highbank-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ia64-acpi-cpufreq.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
imx6q-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
imx-cpufreq-dt.c cpufreq: imx-cpufreq-dt: Add i.MX8MN support 2019-08-22 11:31:04 +05:30
intel_pstate.c cpufreq: Use per-policy frequency QoS 2019-10-21 02:05:21 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Kconfig.arm Merge branch 'cpufreq/qcom-updates' into cpufreq/arm/linux-next 2019-09-03 07:55:22 +05:30
Kconfig.powerpc treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Kconfig.x86 treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kirkwood-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
longhaul.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
longhaul.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
longrun.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
loongson1-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
loongson2_cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
Makefile Merge branch 'cpufreq/qcom-updates' into cpufreq/arm/linux-next 2019-09-03 07:55:22 +05:30
maple-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
mediatek-cpufreq.c cpufreq: mediatek: Add support for mt8183 2019-08-22 11:31:04 +05:30
mvebu-cpufreq.c cpufreq: mvebu: Remove OPPs using dev_pm_opp_remove() 2018-09-19 14:56:44 -07:00
omap-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
p4-clockmod.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pasemi-cpufreq.c cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init() 2019-07-23 09:49:10 +02:00
pcc-cpufreq.c cpufreq: pcc-cpufreq: Fail initialization if driver cannot be registered 2019-06-17 12:25:30 +02:00
pmac32-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
pmac64-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
powernow-k6.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
powernow-k7.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
powernow-k7.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
powernow-k8.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
powernow-k8.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 347 2019-06-05 17:37:08 +02:00
powernv-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 118 2019-05-24 17:39:02 +02:00
ppc_cbe_cpufreq_pervasive.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 153 2019-05-30 11:26:32 -07:00
ppc_cbe_cpufreq_pmi.c cpufreq: Use per-policy frequency QoS 2019-10-21 02:05:21 +02:00
ppc_cbe_cpufreq.c cpufreq: powerpc_cbe: Switch to QoS requests for freq limits 2019-08-26 10:02:01 +02:00
ppc_cbe_cpufreq.h cpufreq: powerpc_cbe: Switch to QoS requests for freq limits 2019-08-26 10:02:01 +02:00
pxa2xx-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
pxa3xx-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
qcom-cpufreq-hw.c cpufreq: qcom-hw: invoke frequency-invariance setter function 2019-08-22 11:31:04 +05:30
qcom-cpufreq-nvmem.c cpufreq: qcom: Add support for qcs404 on nvmem driver 2019-09-03 07:55:00 +05:30
qoriq-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
raspberrypi-cpufreq.c cpufreq: add driver for Raspberry Pi 2019-06-13 08:58:22 +05:30
s3c24xx-cpufreq-debugfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s3c24xx-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s3c64xx-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
s3c2410-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s3c2412-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s3c2416-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
s3c2440-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s5pv210-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
sa1100-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
sa1110-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
sc520_freq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
scmi-cpufreq.c Merge branch 'pm-opp' 2019-03-04 11:19:14 +01:00
scpi-cpufreq.c cpufreq: scpi: Fix use after free 2019-03-28 11:14:31 +01:00
sfi-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 235 2019-06-19 17:09:07 +02:00
sh-cpufreq.c cpufreq: sh: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
sparc-us2e-cpufreq.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
sparc-us3-cpufreq.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
spear-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
speedstep-centrino.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
speedstep-ich.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
speedstep-lib.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
speedstep-lib.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
speedstep-smi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
sti-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 312 2019-06-05 17:37:04 +02:00
sun50i-cpufreq-nvmem.c cpufreq: Add sun50i nvmem based CPU scaling driver 2019-07-22 11:10:51 +05:30
tango-cpufreq.c cpufreq: dt: Don't use generic platdev driver for tango 2017-07-22 02:20:59 +02:00
tegra20-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
tegra124-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
tegra186-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
ti-cpufreq.c cpufreq: ti-cpufreq: Mark expected switch fall-through 2019-07-30 08:10:45 +05:30
unicore2-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
vexpress-spc-cpufreq.c cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const 2017-11-08 23:22:20 +01:00