lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <AS8PR04MB864268FE54C7EE0E51D2875087D52@AS8PR04MB8642.eurprd04.prod.outlook.com>
Date: Fri, 7 Mar 2025 02:33:13 +0000
From: Jacky Bai <ping.bai@....com>
To: Sudeep Holla <sudeep.holla@....com>, Ulf Hansson <ulf.hansson@...aro.org>
CC: "lpieralisi@...nel.org" <lpieralisi@...nel.org>, "rafael@...nel.org"
	<rafael@...nel.org>, "daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>,
	"james.morse@....com" <james.morse@....com>, "d-gole@...com" <d-gole@...com>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
	"khilman@...libre.com" <khilman@...libre.com>, "quic_tingweiz@...cinc.com"
	<quic_tingweiz@...cinc.com>, "quic_yuanjiey@...cinc.com"
	<quic_yuanjiey@...cinc.com>
Subject: RE: [PATCH v3] cpuidle: psci: Init cpuidle only for present CPUs

> Subject: Re: [PATCH v3] cpuidle: psci: Init cpuidle only for present CPUs
> 
> 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@....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.
> >
> 
> 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.
> 

Yes, there are several other cpuidle drivers should have the similar issue, also
some other driver like cpufreq also need to covert to use present mask.

I will do a further check and fix them all together.

BR
> --
> Regards,
> Sudeep

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ