drivers/acpi/processor_idle.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
The 'power_setup_done' flag is a key indicator used across the ACPI
processor driver to determine if cpuidle are properly configured and
available for a given CPU.
Currently, this flag is set during the early stages of initialization.
However, if the subsequent registration of the cpuidle driver in
acpi_processor_register_idle_driver() or the per-CPU device registration
in acpi_processor_power_init() fails, this flag remains set. This may
lead to some issues where other functions in ACPI idle driver use these
flags.
Fix this by explicitly resetting this flag to 0 in these error paths.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/acpi/processor_idle.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 2adaee0f32ed..c1cddb4a5887 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1378,6 +1378,7 @@ void acpi_processor_register_idle_driver(void)
ret = cpuidle_register_driver(&acpi_idle_driver);
if (ret) {
+ pr->flags.power_setup_done = 0;
pr_debug("register %s failed.\n", acpi_idle_driver.name);
return;
}
@@ -1386,7 +1387,16 @@ void acpi_processor_register_idle_driver(void)
void acpi_processor_unregister_idle_driver(void)
{
+ struct acpi_processor *pr;
+ int cpu;
+
cpuidle_unregister_driver(&acpi_idle_driver);
+ for_each_possible_cpu(cpu) {
+ pr = per_cpu(processors, cpu);
+ if (!pr)
+ continue;
+ pr->flags.power_setup_done = 0;
+ }
}
void acpi_processor_power_init(struct acpi_processor *pr)
@@ -1423,6 +1433,7 @@ void acpi_processor_power_init(struct acpi_processor *pr)
*/
if (cpuidle_register_device(dev)) {
per_cpu(acpi_cpuidle_device, pr->id) = NULL;
+ pr->flags.power_setup_done = 0;
kfree(dev);
}
}
--
2.33.0
On Fri, Apr 3, 2026 at 10:53 AM Huisong Li <lihuisong@huawei.com> wrote:
>
> The 'power_setup_done' flag is a key indicator used across the ACPI
> processor driver to determine if cpuidle are properly configured and
> available for a given CPU.
>
> Currently, this flag is set during the early stages of initialization.
> However, if the subsequent registration of the cpuidle driver in
> acpi_processor_register_idle_driver() or the per-CPU device registration
> in acpi_processor_power_init() fails, this flag remains set. This may
> lead to some issues where other functions in ACPI idle driver use these
> flags.
>
> Fix this by explicitly resetting this flag to 0 in these error paths.
>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> ---
> drivers/acpi/processor_idle.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index 2adaee0f32ed..c1cddb4a5887 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -1378,6 +1378,7 @@ void acpi_processor_register_idle_driver(void)
>
> ret = cpuidle_register_driver(&acpi_idle_driver);
> if (ret) {
> + pr->flags.power_setup_done = 0;
> pr_debug("register %s failed.\n", acpi_idle_driver.name);
> return;
> }
> @@ -1386,7 +1387,16 @@ void acpi_processor_register_idle_driver(void)
>
> void acpi_processor_unregister_idle_driver(void)
> {
> + struct acpi_processor *pr;
> + int cpu;
> +
> cpuidle_unregister_driver(&acpi_idle_driver);
> + for_each_possible_cpu(cpu) {
> + pr = per_cpu(processors, cpu);
> + if (!pr)
> + continue;
> + pr->flags.power_setup_done = 0;
> + }
> }
>
> void acpi_processor_power_init(struct acpi_processor *pr)
> @@ -1423,6 +1433,7 @@ void acpi_processor_power_init(struct acpi_processor *pr)
> */
> if (cpuidle_register_device(dev)) {
> per_cpu(acpi_cpuidle_device, pr->id) = NULL;
> + pr->flags.power_setup_done = 0;
> kfree(dev);
> }
> }
> --
Applied as 7.1 material, thanks!
© 2016 - 2026 Red Hat, Inc.