Re: [PATCH 38/39] cpumask: Add enabled cpumask for present CPUs that can be brought online

"Russell King (Oracle)" <[email protected]>
Newsgroups gmane.linux.ports.parisc,gmane.linux.power-management.general,gmane.linux.acpi.devel,gmane.linux.kernel.cross-arch,gmane.linux.kernel,gmane.linux.ports.arm.kernel,gmane.linux.ports.riscv,gmane.linux.documentation,gmane.linux.ports.ia64
Message-ID <[email protected]>
On Tue, Oct 24, 2023 at 06:02:30PM +0200, Greg Kroah-Hartman wrote:
> On Tue, Oct 24, 2023 at 04:19:24PM +0100, Russell King wrote:
> > From: James Morse <[email protected]>
> > 
> > The 'offline' file in sysfs shows all offline CPUs, including those
> > that aren't present. User-space is expected to remove not-present CPUs
> > from this list to learn which CPUs could be brought online.
> > 
> > CPUs can be present but not-enabled. These CPUs can't be brought online
> > until the firmware policy changes, which comes with an ACPI notification
> > that will register the CPUs.
> > 
> > With only the offline and present files, user-space is unable to
> > determine which CPUs it can try to bring online. Add a new CPU mask
> > that shows this based on all the registered CPUs.
> > 
> > Signed-off-by: James Morse <[email protected]>
> > ---
> >  drivers/base/cpu.c      | 10 ++++++++++
> >  include/linux/cpumask.h | 25 +++++++++++++++++++++++++
> >  kernel/cpu.c            |  3 +++
> >  3 files changed, 38 insertions(+)
> > 
> > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> > index 2b9cb2667654..f8bf1d4c7d71 100644
> > --- a/drivers/base/cpu.c
> > +++ b/drivers/base/cpu.c
> > @@ -95,6 +95,7 @@ void unregister_cpu(struct cpu *cpu)
> >  {
> >  	int logical_cpu = cpu->dev.id;
> >  
> > +	set_cpu_enabled(logical_cpu, false);
> >  	unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu));
> >  
> >  	device_unregister(&cpu->dev);
> > @@ -273,6 +274,13 @@ static ssize_t print_cpus_offline(struct device *dev,
> >  }
> >  static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
> >  
> > +static ssize_t print_cpus_enabled(struct device *dev,
> > +				  struct device_attribute *attr, char *buf)
> > +{
> > +	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpu_enabled_mask));
> > +}
> > +static DEVICE_ATTR(enabled, 0444, print_cpus_enabled, NULL);
> 
> This needs to be documented somewhere in Documentation/ABI/ did I miss
> that patch?

Thanks for pointing that out, no you missed the patch as nothing
touches Documentation/ABI/ in this patch series. I'll add some blurb
for it for the next iteration.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.