From: Sudeep Holla <sudeep.holla@arm.com>
To: Jacky Bai <ping.bai@nxp.com>
Cc: "rafael@kernel.org" <rafael@kernel.org>,
"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
"james.morse@arm.com" <james.morse@arm.com>,
"d-gole@ti.com" <d-gole@ti.com>,
"anup@brainfault.org" <anup@brainfault.org>,
"paul.walmsley@sifive.com" <paul.walmsley@sifive.com>,
"palmer@dabbelt.com" <palmer@dabbelt.com>,
"aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"imx@lists.linux.dev" <imx@lists.linux.dev>,
"khilman@baylibre.com" <khilman@baylibre.com>,
"quic_tingweiz@quicinc.com" <quic_tingweiz@quicinc.com>,
"quic_yuanjiey@quicinc.com" <quic_yuanjiey@quicinc.com>
Subject: Re: [PATCH v4] cpuidle: Init cpuidle only for present CPUs
Date: Fri, 7 Mar 2025 10:19:03 +0000 [thread overview]
Message-ID: <Z8rIF3fQr958cf8g@bogus> (raw)
In-Reply-To: <AS8PR04MB86425524495B3FEF19F32E6B87D52@AS8PR04MB8642.eurprd04.prod.outlook.com>
On Fri, Mar 07, 2025 at 10:10:50AM +0000, Jacky Bai wrote:
> > Subject: Re: [PATCH v4] cpuidle: Init cpuidle only for present CPUs
> >
> > On Fri, Mar 07, 2025 at 10:02:14AM +0000, Jacky Bai wrote:
> > > Hi Sudeep,
> > >
> > > > Subject: Re: [PATCH v4] cpuidle: Init cpuidle only for present CPUs
> > > >
> > > > On Fri, Mar 07, 2025 at 04:03:03PM +0800, Jacky Bai wrote:
> > > > > 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-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: b0c69e1214bc ("drivers: base: Use present CPUs in
> > > > > GENERIC_CPU_DEVICES")
> > > > > Reviewed-by: Dhruva Gole <d-gole@ti.com>
> > > > > Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> > > > > Tested-by: Yuanjie Yang <quic_yuanjiey@quicinc.com>
> > > > > Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> > > > > ---
> > > > > - v4 changes:
> > > > > - add changes for other cpuidle driver that has the similar issue
> > > > > as cpuidle-pcsi driver.
> > > > >
> > > > > - v3 changes:
> > > > > - improve the changelog as suggested by Sudeep
> > > > > ---
> > > > > drivers/cpuidle/cpuidle-arm.c | 8 ++++----
> > > > > drivers/cpuidle/cpuidle-big_little.c | 2 +-
> > > > > drivers/cpuidle/cpuidle-psci.c | 4 ++--
> > > > > drivers/cpuidle/cpuidle-riscv-sbi.c | 4 ++--
> > > >
> > > >
> > > > Why have you spared drivers/cpuidle/cpuidle-qcom-spm.c ? IIUC the
> > > > issue exists there as well.
> > > >
> > >
> > > For qcom-spm driver, it has below code logic to handle no cpu device
> > > case, and no rollback to cancel the whole cpuidle registration. So I just leave
> > it as it is.
> > > Do we need to update it?
> > >
> > > for_each_possible_cpu(cpu) {
> > > ret = spm_cpuidle_register(&pdev->dev, cpu);
> >
> > Did you look into this function ?
>
> Yes, at the very beginning of this function it will check if the cpu device
> is available, if not, directly return -ENODEV, something I misunderstood?
>
So why do you think spm_cpuidle_register() does anything different than
psci_idle_init_cpu(). They do exactly same check and yet you apply the
change for psci_idle_init_cpu() but not for spm_cpuidle_register().
What am I missing ?
--
Regards,
Sudeep
next prev parent reply other threads:[~2025-03-07 10:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 8:03 [PATCH v4] cpuidle: Init cpuidle only for present CPUs Jacky Bai
2025-03-07 9:50 ` Sudeep Holla
2025-03-07 10:02 ` Jacky Bai
2025-03-07 10:04 ` Sudeep Holla
2025-03-07 10:10 ` Jacky Bai
2025-03-07 10:19 ` Sudeep Holla [this message]
2025-03-07 10:26 ` Jacky Bai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z8rIF3fQr958cf8g@bogus \
--to=sudeep.holla@arm.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=d-gole@ti.com \
--cc=daniel.lezcano@linaro.org \
--cc=imx@lists.linux.dev \
--cc=james.morse@arm.com \
--cc=khilman@baylibre.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=ping.bai@nxp.com \
--cc=quic_tingweiz@quicinc.com \
--cc=quic_yuanjiey@quicinc.com \
--cc=rafael@kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox