linux-stable/drivers/cpuidle
Shawn Guo 6b0313c2fa cpuidle: psci: Iterate backwards over list in psci_pd_remove()
In case that psci_pd_init_topology() fails for some reason,
psci_pd_remove() will be responsible for deleting provider and removing
genpd from psci_pd_providers list.  There will be a failure when removing
the cluster PD, because the cpu (child) PDs haven't been removed.

[    0.050232] CPUidle PSCI: init PM domain cpu0
[    0.050278] CPUidle PSCI: init PM domain cpu1
[    0.050329] CPUidle PSCI: init PM domain cpu2
[    0.050370] CPUidle PSCI: init PM domain cpu3
[    0.050422] CPUidle PSCI: init PM domain cpu-cluster0
[    0.050475] PM: genpd_remove: unable to remove cpu-cluster0
[    0.051412] PM: genpd_remove: removed cpu3
[    0.051449] PM: genpd_remove: removed cpu2
[    0.051499] PM: genpd_remove: removed cpu1
[    0.051546] PM: genpd_remove: removed cpu0

Fix the problem by iterating the provider list reversely, so that parent
PD gets removed after child's PDs like below.

[    0.029052] CPUidle PSCI: init PM domain cpu0
[    0.029076] CPUidle PSCI: init PM domain cpu1
[    0.029103] CPUidle PSCI: init PM domain cpu2
[    0.029124] CPUidle PSCI: init PM domain cpu3
[    0.029151] CPUidle PSCI: init PM domain cpu-cluster0
[    0.029647] PM: genpd_remove: removed cpu0
[    0.029666] PM: genpd_remove: removed cpu1
[    0.029690] PM: genpd_remove: removed cpu2
[    0.029714] PM: genpd_remove: removed cpu3
[    0.029738] PM: genpd_remove: removed cpu-cluster0

Fixes: a65a397f24 ("cpuidle: psci: Add support for PM domains by using genpd")
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: 5.10+ <stable@vger.kernel.org> # 5.10+
Signed-off-by: Rafael J. Wysocki <rjw@rjwysocki.net>
2023-03-07 14:04:13 +01:00
..
governors cpuidle: teo: Introduce util-awareness 2023-01-10 20:53:22 +01:00
Kconfig cpuidle-haltpoll: select haltpoll governor 2023-01-13 20:50:46 +01:00
Kconfig.arm cpuidle: psci: Do not suspend topology CPUs on PREEMPT_RT 2023-02-13 17:15:42 +01:00
Kconfig.mips treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Kconfig.powerpc treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Kconfig.riscv cpuidle: Add RISC-V SBI CPU idle driver 2022-03-10 09:29:51 -08:00
Makefile cpuidle: Add RISC-V SBI CPU idle driver 2022-03-10 09:29:51 -08:00
coupled.c cpuidle: coupled: Drop duplicate word from a comment 2022-08-31 20:54:01 +02:00
cpuidle-arm.c cpuidle, arch: Mark all ct_cpuidle_enter() callers __cpuidle 2023-01-13 11:48:17 +01:00
cpuidle-at91.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 2) 2022-06-10 14:51:35 +02:00
cpuidle-big_little.c cpuidle, arch: Mark all ct_cpuidle_enter() callers __cpuidle 2023-01-13 11:48:17 +01:00
cpuidle-calxeda.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
cpuidle-clps711x.c cpuidle: clps711x: convert to devm_platform_ioremap_resource() 2019-12-20 10:04:27 +01:00
cpuidle-cps.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cpuidle-exynos.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpuidle-haltpoll.c cpuidle-haltpoll: Replace default_idle() with arch_cpu_idle() 2023-01-20 17:33:52 +01:00
cpuidle-kirkwood.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 2) 2022-06-10 14:51:35 +02:00
cpuidle-mvebu-v7.c cpuidle: mvebu: Fix duplicate flags assignment 2023-01-18 12:03:54 +01:00
cpuidle-powernv.c powerpc/cpuidle: Set CPUIDLE_FLAG_POLLING for snooze state 2022-12-06 23:18:19 +11:00
cpuidle-psci-domain.c cpuidle: psci: Iterate backwards over list in psci_pd_remove() 2023-03-07 14:04:13 +01:00
cpuidle-psci.c Power management updates for 6.3-rc1 2023-02-21 12:13:58 -08:00
cpuidle-psci.h cpuidle: Factor-out power domain related code from PSCI domain driver 2022-03-10 09:29:44 -08:00
cpuidle-pseries.c powerpc/cpuidle: Set CPUIDLE_FLAG_POLLING for snooze state 2022-12-06 23:18:19 +11:00
cpuidle-qcom-spm.c ARM: SoC drivers for 6.3 2023-02-27 10:04:49 -08:00
cpuidle-riscv-sbi.c cpuidle, arch: Mark all ct_cpuidle_enter() callers __cpuidle 2023-01-13 11:48:17 +01:00
cpuidle-tegra.c cpuidle, arch: Mark all ct_cpuidle_enter() callers __cpuidle 2023-01-13 11:48:17 +01:00
cpuidle-ux500.c mfd/cpuidle: ux500: Rename driver symbol 2021-08-16 13:42:34 +01:00
cpuidle-zynq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
cpuidle.c cpuidle: Fix poll_idle() noinstr annotation 2023-01-31 15:01:47 +01:00
cpuidle.h cpuidle: allow governor switch on cpuidle_register_driver() 2019-09-11 17:36:30 +02:00
driver.c cpuidle: driver: Update microsecond values of state parameters as needed 2023-02-13 16:08:44 +01:00
dt_idle_genpd.c cpuidle: Factor-out power domain related code from PSCI domain driver 2022-03-10 09:29:44 -08:00
dt_idle_genpd.h cpuidle: Factor-out power domain related code from PSCI domain driver 2022-03-10 09:29:44 -08:00
dt_idle_states.c cpuidle, dt: Push RCU-idle into driver 2023-01-13 11:48:00 +01:00
dt_idle_states.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
governor.c cpuidle: Remove redundant check in cpuidle_switch_governor() 2022-09-03 20:14:51 +02:00
poll_state.c cpuidle: Fix poll_idle() noinstr annotation 2023-01-31 15:01:47 +01:00
sysfs.c cpuidle: sysfs: make kobj_type structures constant 2023-02-09 21:04:01 +01:00