linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Jacky Bai <ping.bai@nxp.com>,
	lpieralisi@kernel.org, rafael@kernel.org,
	daniel.lezcano@linaro.org, james.morse@arm.com, d-gole@ti.com,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, imx@lists.linux.dev,
	khilman@baylibre.com, quic_tingweiz@quicinc.com,
	quic_yuanjiey@quicinc.com
Subject: Re: [PATCH v3] cpuidle: psci: Init cpuidle only for present CPUs
Date: Thu, 6 Mar 2025 12:42:39 +0000	[thread overview]
Message-ID: <Z8mYP7AGBPeDTvXn@bogus> (raw)
In-Reply-To: <CAPDyKForY4VNZtqietDPt2FQM3p4OsaoE_oJb0PPLUAh98WsHQ@mail.gmail.com>

On Thu, Mar 06, 2025 at 11:53:14AM +0100, Ulf Hansson wrote:
> On Thu, 6 Mar 2025 at 07:17, Jacky Bai <ping.bai@nxp.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@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>
> 
> Is this problem specific to cpuidle-psci?
> 
> Others are using for_each_possible_cpu() when registering their cpuidle drivers.
> 

Good point. I assumed as this was very old patch, only this is left without
conversion to using present_cpumask. Looks like there are many other drivers
that need similar change. May be PSCI is most commonly used ones these days
and hardly anyone tests with nosmp or maxcpus=1 on those platforms.

But yes, all the users of for_each_possible_cpu() need to move to
for_each_present_cpu() if they are relying on CPU device being registered.

-- 
Regards,
Sudeep


  reply	other threads:[~2025-03-06 13:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06  6:18 [PATCH v3] cpuidle: psci: Init cpuidle only for present CPUs Jacky Bai
2025-03-06 10:53 ` Ulf Hansson
2025-03-06 12:42   ` Sudeep Holla [this message]
2025-03-07  2:33     ` 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=Z8mYP7AGBPeDTvXn@bogus \
    --to=sudeep.holla@arm.com \
    --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=lpieralisi@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).