Commit 68cb0139 authored by Jacky Bai's avatar Jacky Bai Committed by Rafael J. Wysocki
Browse files

cpuidle: Init cpuidle only for present CPUs



for_each_possible_cpu() is currently used to initialize cpuidle
in below cpuidle drivers:
  drivers/cpuidle/cpuidle-arm.c
  drivers/cpuidle/cpuidle-big_little.c
  drivers/cpuidle/cpuidle-psci.c
  drivers/cpuidle/cpuidle-qcom-spm.c
  drivers/cpuidle/cpuidle-riscv-sbi.c

However, in cpu_dev_register_generic(), for_each_present_cpu()
is used to register CPU devices which means the CPU devices are
only registered for present CPUs and not all possible CPUs.

With nosmp or maxcpus=0, only the boot CPU is present, lead
to the failure:

  |  Failed to register cpuidle device for cpu1

Then rollback to cancel all CPUs' cpuidle registration.

Change for_each_possible_cpu() to for_each_present_cpu() in the
above cpuidle drivers to ensure it only registers cpuidle devices
for CPUs that are actually present.

Fixes: b0c69e12 ("drivers: base: Use present CPUs in GENERIC_CPU_DEVICES")
Reviewed-by: default avatarDhruva Gole <d-gole@ti.com>
Reviewed-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Tested-by: default avatarYuanjie Yang <quic_yuanjiey@quicinc.com>
Signed-off-by: default avatarJacky Bai <ping.bai@nxp.com>
Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Link: https://patch.msgid.link/20250307145547.2784821-1-ping.bai@nxp.com


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 3332dd12
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment