public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpuidle: psci: Init cpuidle only for present CPUs
@ 2024-11-20  7:06 Jacky Bai
  2024-11-20  9:30 ` Dhruva Gole
  0 siblings, 1 reply; 3+ messages in thread
From: Jacky Bai @ 2024-11-20  7:06 UTC (permalink / raw)
  To: lpieralisi, sudeep.holla, rafael, daniel.lezcano, james.morse
  Cc: linux-pm, linux-arm-kernel, linux-kernel, imx

With 'nosmp' or 'maxcpus=0' boot command line paremeters,
the 'cpu_present_mask' may not be the same as 'cpu_possible_mask'

In current psci cpuidle driver init, for_each_possible_cpu()
is used to init the cpudile for each possible CPU. but in
drivers/base/cpu.c ->cpu_dev_register_generic(),
for_each_present_cpu() is used to register cpu device for
present CPUs.

When boot system with 'nosmp' or 'maxcpus=0', the cpuidle driver
init failed due to no valid CPU device sysfs node for non-boot CPUs.

[ 0.182993] Failed to register cpuidle device for cpu1

Use for_each_present_cpu() to register cpuidle only for present
CPUs.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
---
 drivers/cpuidle/cpuidle-psci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
index 2562dc001fc1..00117e9b33e8 100644
--- a/drivers/cpuidle/cpuidle-psci.c
+++ b/drivers/cpuidle/cpuidle-psci.c
@@ -410,7 +410,7 @@ static int psci_cpuidle_probe(struct platform_device *pdev)
 	struct cpuidle_driver *drv;
 	struct cpuidle_device *dev;
 
-	for_each_possible_cpu(cpu) {
+	for_each_present_cpu(cpu) {
 		ret = psci_idle_init_cpu(&pdev->dev, cpu);
 		if (ret)
 			goto out_fail;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-20  9:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-20  7:06 [PATCH] cpuidle: psci: Init cpuidle only for present CPUs Jacky Bai
2024-11-20  9:30 ` Dhruva Gole
2024-11-20  9:41   ` Jacky Bai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox