lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251125072933.3706006-4-lihuisong@huawei.com>
Date: Tue, 25 Nov 2025 15:29:33 +0800
From: Huisong Li <lihuisong@...wei.com>
To: <rafael@...nel.org>, <lenb@...nel.org>
CC: <linux-acpi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<Sudeep.Holla@....com>, <linuxarm@...wei.com>, <jonathan.cameron@...wei.com>,
	<zhanjie9@...ilicon.com>, <zhenglifeng1@...wei.com>, <yubowen8@...wei.com>,
	<lihuisong@...wei.com>
Subject: [PATCH 3/3] ACPI: processor: idle: Update idle states from avaiable power information

Currently, the ACPI power notify makes it once per system instead of once per-cpu.
And driver selects the notify on CPU0 to update idle states.

The same idle state is used for all CPUs. An avaiable power information
is obtained successfully from any CPUs can be used to populate the ACPI idle
states as acpi_processor_register_idle_driver() did.
So keep the same logical to get avaiable power information from online CPUs
instead of CPU0 to update idle states in power notify.

Signed-off-by: Huisong Li <lihuisong@...wei.com>
---
 drivers/acpi/processor_idle.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index cd4d1d8d70b0..8d3122a4e6d0 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1332,19 +1332,26 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
 		 *
 		 * The same idle state is used for all CPUs.
 		 * The old idle state may not be usable anymore if fail to get
-		 * ACPI power information of CPU0.
+		 * available ACPI power information from any online CPU.
 		 * The cpuidle of all CPUs should be disabled.
 		 */
-		ret = acpi_processor_get_power_info(pr);
+		ret = -ENODEV;
+		for_each_online_cpu(cpu) {
+			_pr = per_cpu(processors, cpu);
+			if (!_pr && !_pr->flags.power_setup_done)
+				continue;
+			ret = acpi_processor_get_power_info(_pr);
+			if (!ret) {
+				acpi_processor_setup_cpuidle_states(_pr);
+				break;
+			}
+		}
 		if (ret) {
 			/* Ensure cpuidle of offline CPUs are inavaliable. */
 			disable_cpuidle();
-			pr_err("Get processor-%u power information failed, disable cpuidle of all CPUs\n",
-			       pr->id);
+			pr_err("No available ACPI power information, disable cpuidle of all CPUs.\n");
 			goto release_lock;
 		}
-
-		acpi_processor_setup_cpuidle_states(pr);
 		enable_cpuidle();
 
 		/* Enable all cpuidle devices */
-- 
2.33.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ