[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKForY4VNZtqietDPt2FQM3p4OsaoE_oJb0PPLUAh98WsHQ@mail.gmail.com>
Date: Thu, 6 Mar 2025 11:53:14 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Jacky Bai <ping.bai@....com>
Cc: lpieralisi@...nel.org, sudeep.holla@....com, rafael@...nel.org,
daniel.lezcano@...aro.org, james.morse@....com, d-gole@...com,
linux-pm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, imx@...ts.linux.dev, khilman@...libre.com,
quic_tingweiz@...cinc.com, quic_yuanjiey@...cinc.com
Subject: Re: [PATCH v3] cpuidle: psci: Init cpuidle only for present CPUs
On Thu, 6 Mar 2025 at 07:17, Jacky Bai <ping.bai@....com> wrote:
>
> for_each_possible_cpu() is currently used to initialize cpuidle
> in the PSCI cpuidle driver.
>
> 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, leading
> to the failure:
>
> | Failed to register cpuidle device for cpu1
>
> Change for_each_possible_cpu() to for_each_present_cpu() in the
> PSCI cpuidle driver to ensure it only registers cpuidle devices
> for CPUs that are actually present.
>
> Fixes: b0c69e1214bc ("drivers: base: Use present CPUs in GENERIC_CPU_DEVICES")
> Reviewed-by: Dhruva Gole <d-gole@...com>
> Reviewed-by: Sudeep Holla <sudeep.holla@....com>
> Tested-by: Yuanjie Yang <quic_yuanjiey@...cinc.com>
> Signed-off-by: Jacky Bai <ping.bai@....com>
Is this problem specific to cpuidle-psci?
Others are using for_each_possible_cpu() when registering their cpuidle drivers.
Kind regards
Uffe
> ---
> - v2 changes:
> - Improve the changelog as suggested by Sudeep
> ---
> 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
>
Powered by blists - more mailing lists