[PATCH v2] ACPI: processor: Add cpuidle driver check in acpi_processor_register_idle_driver

Tony W Wang-oc posted 1 patch 2 weeks, 2 days ago
drivers/acpi/processor_idle.c | 9 +++++++++
1 file changed, 9 insertions(+)
[PATCH v2] ACPI: processor: Add cpuidle driver check in acpi_processor_register_idle_driver
Posted by Tony W Wang-oc 2 weeks, 2 days ago
Commit 7a8c994cbb2d ("ACPI: processor: idle: Optimize ACPI idle
driver registration") moved the ACPI idle driver registration to
acpi_processor_driver_init(), but it didn't check whether a cpuidle
driver was already registered.

For example, on Intel platforms, if the intel_idle driver is already
loaded, the code would still evaluate the _CST object in the ACPI
table and attempt to register the acpi_idle driver. This registration
would fail with -EBUSY due to the existing check in cpuidle_register_driver.

Add a check at the beginning of acpi_processor_register_idle_driver()
to avoid unnecessary _CST evaluate and potential registration failures.

Fixes: 7a8c994cbb2d ("ACPI: processor: idle: Optimize ACPI idle driver registration")
Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
---
Changes in v2:
- Added comment to explain why we skip registration when a driver is
  already present.

 drivers/acpi/processor_idle.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index ee5facccbe10..390ab5f1d313 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1355,6 +1355,15 @@ void acpi_processor_register_idle_driver(void)
 	int ret = -ENODEV;
 	int cpu;
 
+	/*
+	 * If a cpuidle driver is already registered, there is no need to
+	 * evaluate _CST or attempt to register the ACPI idle driver.
+	 */
+	if (cpuidle_get_driver()) {
+		pr_debug("cpuidle driver %pS already registered.\n", cpuidle_get_driver());
+		return;
+	}
+
 	acpi_processor_update_max_cstate();
 
 	/*
-- 
2.25.1
Re: [PATCH v2] ACPI: processor: Add cpuidle driver check in acpi_processor_register_idle_driver
Posted by Rafael J. Wysocki 2 weeks, 2 days ago
On Mon, Jun 8, 2026 at 1:04 PM Tony W Wang-oc <TonyWWang-oc@zhaoxin.com> wrote:
>
> Commit 7a8c994cbb2d ("ACPI: processor: idle: Optimize ACPI idle
> driver registration") moved the ACPI idle driver registration to
> acpi_processor_driver_init(), but it didn't check whether a cpuidle
> driver was already registered.
>
> For example, on Intel platforms, if the intel_idle driver is already
> loaded, the code would still evaluate the _CST object in the ACPI
> table and attempt to register the acpi_idle driver. This registration
> would fail with -EBUSY due to the existing check in cpuidle_register_driver.
>
> Add a check at the beginning of acpi_processor_register_idle_driver()
> to avoid unnecessary _CST evaluate and potential registration failures.
>
> Fixes: 7a8c994cbb2d ("ACPI: processor: idle: Optimize ACPI idle driver registration")
> Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
> ---
> Changes in v2:
> - Added comment to explain why we skip registration when a driver is
>   already present.
>
>  drivers/acpi/processor_idle.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index ee5facccbe10..390ab5f1d313 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -1355,6 +1355,15 @@ void acpi_processor_register_idle_driver(void)
>         int ret = -ENODEV;
>         int cpu;
>
> +       /*
> +        * If a cpuidle driver is already registered, there is no need to
> +        * evaluate _CST or attempt to register the ACPI idle driver.
> +        */
> +       if (cpuidle_get_driver()) {
> +               pr_debug("cpuidle driver %pS already registered.\n", cpuidle_get_driver());
> +               return;
> +       }
> +
>         acpi_processor_update_max_cstate();
>
>         /*
> --

Applied as 7.2 material, thanks!