linux-stable/drivers/cpufreq
Rafael J. Wysocki 89ab39da14 cpufreq: Avoid cpufreq_suspend() deadlock on system shutdown
commit 65650b3513 upstream.

It is incorrect to set the cpufreq syscore shutdown callback pointer
to cpufreq_suspend(), because that function cannot be run in the
syscore stage of system shutdown for two reasons: (a) it may attempt
to carry out actions depending on devices that have already been shut
down at that point and (b) the RCU synchronization carried out by it
may not be able to make progress then.

The latter issue has been present since commit 45975c7d21 ("rcu:
Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds"),
but the former one has been there since commit 90de2a4aa9 ("cpufreq:
suspend cpufreq governors on shutdown") regardless.

Fix that by dropping cpufreq_syscore_ops altogether and making
device_shutdown() call cpufreq_suspend() directly before shutting
down devices, which is along the lines of what system-wide power
management does.

Fixes: 45975c7d21 ("rcu: Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds")
Fixes: 90de2a4aa9 ("cpufreq: suspend cpufreq governors on shutdown")
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 4.0+ <stable@vger.kernel.org> # 4.0+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-29 09:20:08 +01:00
..
acpi-cpufreq.c cpufreq: acpi-cpufreq: Report if CPU doesn't support boost technologies 2019-04-05 22:33:03 +02:00
amd_freq_sensitivity.c cpufreq: AMD: Ignore the check for ProcFeedback in ST/CZ 2018-02-07 11:26:37 +01:00
arm_big_little.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
arm_big_little.h cpufreq: arm_big_little: make function arguments and structure pointer const 2017-11-08 23:22:19 +01:00
arm_big_little_dt.c cpufreq: arm_big_little: make cpufreq_arm_bL_ops structures const 2017-11-08 23:22:20 +01:00
armada-37xx-cpufreq.c cpufreq: armada-37xx: fix frequency calculation for opp 2019-05-10 17:54:10 +02:00
bmips-cpufreq.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
brcmstb-avs-cpufreq.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
cppc_cpufreq.c cpufreq / CPPC: Add cpuinfo_cur_freq support for CPPC 2018-07-18 10:13:16 +02:00
cpufreq-dt-platdev.c cpufreq: Add Kryo CPU scaling driver 2018-05-30 12:53:11 +02:00
cpufreq-dt.c cpufreq: dt: Try freeing static OPPs only if we have added them 2018-11-13 11:08:24 -08:00
cpufreq-dt.h cpufreq: dt: Allow platform specific suspend/resume callbacks 2018-05-10 11:43:59 +02:00
cpufreq-nforce2.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
cpufreq.c cpufreq: Avoid cpufreq_suspend() deadlock on system shutdown 2019-10-29 09:20:08 +01:00
cpufreq_conservative.c cpufreq: conservative: Take limits changes into account properly 2018-11-13 11:08:16 -08:00
cpufreq_governor.c sched/cpufreq: Fix kobject memleak 2019-05-31 06:46:12 -07:00
cpufreq_governor.h cpufreq: Replace "max_transition_latency" with "dynamic_switching" 2017-07-26 00:15:45 +02:00
cpufreq_governor_attr_set.c
cpufreq_ondemand.c cpufreq: governor: Drop min_sampling_rate 2017-07-22 02:25:20 +02:00
cpufreq_ondemand.h
cpufreq_performance.c
cpufreq_powersave.c
cpufreq_stats.c cpufreq: stats: Change return type of cpufreq_stats_update() as void 2018-01-05 13:22:46 +01:00
cpufreq_userspace.c
davinci-cpufreq.c ARM: davinci: da850: fix da850_set_pll0rate() 2017-01-02 15:02:51 +05:30
e_powersaver.c cpufreq: e_powersaver: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
elanfreq.c cpufreq: elanfreq: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
freq_table.c cpufreq: Drop cpufreq_table_validate_and_show() 2018-04-10 08:40:45 +02:00
gx-suspmod.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
highbank-cpufreq.c
ia64-acpi-cpufreq.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
imx6q-cpufreq.c cpufreq: imx6q: add return value check for voltage scale 2018-12-01 09:37:32 +01:00
intel_pstate.c x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:17:53 +02:00
Kconfig cpufreq: remove at32ap-cpufreq 2018-02-07 11:44:23 +01:00
Kconfig.arm cpufreq: exynos: Remove support for Exynos5440 2018-07-17 19:55:51 +02:00
Kconfig.powerpc
Kconfig.x86 sched/x86: Change CONFIG_SCHED_ITMT to CONFIG_SCHED_MC_PRIO 2016-11-30 08:27:08 +01:00
kirkwood-cpufreq.c cpufreq: kirkwood: fix possible object reference leak 2019-05-31 06:46:24 -07:00
longhaul.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
longhaul.h
longrun.c cpufreq: Don't set transition_latency for setpolicy drivers 2017-07-26 00:15:43 +02:00
loongson1-cpufreq.c
loongson2_cpufreq.c cpufreq: Loongson2: constify platform_device_id 2017-08-18 01:44:21 +02:00
Makefile cpufreq: exynos: Remove support for Exynos5440 2018-07-17 19:55:51 +02:00
maple-cpufreq.c
mediatek-cpufreq.c cpufreq: mediatek: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
mvebu-cpufreq.c cpufreq: mvebu: Free opp if registering failed 2017-12-16 02:29:43 +01:00
omap-cpufreq.c PM / OPP: Update OPP users to put reference 2017-01-30 09:22:21 +01:00
p4-clockmod.c cpufreq: p4-clockmod: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
pasemi-cpufreq.c cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init() 2019-08-16 10:12:46 +02:00
pcc-cpufreq.c Merge back cpufreq material for 4.19. 2018-07-25 13:28:01 +02:00
pmac32-cpufreq.c cpufreq: pmac32: fix possible object reference leak 2019-05-31 06:46:24 -07:00
pmac64-cpufreq.c cpufreq: Convert to using %pOF instead of full_name 2017-08-25 01:20:46 +02:00
powernow-k6.c cpufreq: powernow: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
powernow-k7.c cpufreq: powernow: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
powernow-k7.h
powernow-k8.c cpufreq: powernow: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
powernow-k8.h
powernv-cpufreq.c cpufreq: powernv: Remove global pstate ramp-down timer in POWER9 2018-07-09 18:06:02 +10:00
ppc_cbe_cpufreq.c cpufreq: ppc_cbe: fix possible object reference leak 2019-05-31 06:46:24 -07:00
ppc_cbe_cpufreq.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ppc_cbe_cpufreq_pervasive.c
ppc_cbe_cpufreq_pmi.c cpufreq: Remove CPUFREQ_START notifier event 2017-02-04 00:05:30 +01:00
pxa2xx-cpufreq.c cpufreq: pxa2xx: remove incorrect __init annotation 2019-03-23 20:10:01 +01:00
pxa3xx-cpufreq.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
qcom-cpufreq-kryo.c cpufreq: kryo: Release OPP tables on module removal 2019-03-23 20:10:01 +01:00
qoriq-cpufreq.c cpufreq: qoirq: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
s3c24xx-cpufreq-debugfs.c
s3c24xx-cpufreq.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
s3c64xx-cpufreq.c cpufreq: s3c64xx: remove incorrect __init annotation 2016-12-21 02:54:18 +01:00
s3c2410-cpufreq.c
s3c2412-cpufreq.c
s3c2416-cpufreq.c cpufreq: s3c2416: double free on driver init error path 2017-02-09 01:22:45 +01:00
s3c2440-cpufreq.c cpufreq: s3c2440: fix spelling mistake: "divsiors" -> "divisors" 2018-05-10 11:50:42 +02:00
s5pv210-cpufreq.c cpufreq: s5pv210: add missing of_node_put() 2017-07-26 22:54:01 +02:00
sa1100-cpufreq.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
sa1110-cpufreq.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +02:00
sc520_freq.c cpufreq: sc520: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
scmi-cpufreq.c cpufreq: scmi: Fix frequency invariance in slow path 2019-01-16 22:04:29 +01:00
scpi-cpufreq.c cpufreq: scpi: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
sfi-cpufreq.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07: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 cpufreq: sparc: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
sparc-us3-cpufreq.c cpufreq: sparc: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
spear-cpufreq.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
speedstep-centrino.c cpufreq: speedstep: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
speedstep-ich.c cpufreq: speedstep: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
speedstep-lib.c cpufreq: speedstep: fix speedstep_detect_processor()'s return type 2018-05-10 11:46:00 +02:00
speedstep-lib.h
speedstep-smi.c cpufreq: speedstep: Don't validate the frequency table twice 2018-03-20 12:07:52 +01:00
sti-cpufreq.c cpufreq: Convert to using %pOF instead of full_name 2017-08-25 01:20:46 +02:00
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: tegra20: Wrap cpufreq into platform driver 2018-05-21 13:44:24 +02:00
tegra124-cpufreq.c cpufreq: tegra124: add missing of_node_put() 2019-03-23 20:10:01 +01:00
tegra186-cpufreq.c cpufreq: tegra186: Don't validate the frequency table twice 2018-03-20 12:07:53 +01:00
ti-cpufreq.c cpufreq: ti-cpufreq: Only register platform_device when supported 2018-12-13 09:16:13 +01:00
unicore2-cpufreq.c cpufreq: Add CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING cpufreq driver flag 2017-07-26 00:15:46 +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