On Tue, Oct 24, 2023 at 04:19:24PM +0100, Russell King wrote: > From: James Morse <james.morse@xxxxxxx> > > 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 <james.morse@xxxxxxx> > --- > 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, greg k-h