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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 14 Sep 2023 11:56:13 +0100
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     "Russell King (Oracle)" <linux@...linux.org.uk>
CC:     James Morse <james.morse@....com>, <linux-pm@...r.kernel.org>,
        <loongarch@...ts.linux.dev>, <linux-acpi@...r.kernel.org>,
        <linux-arch@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-riscv@...ts.infradead.org>, <kvmarm@...ts.linux.dev>,
        <x86@...nel.org>, Salil Mehta <salil.mehta@...wei.com>,
        Jean-Philippe Brucker <jean-philippe@...aro.org>,
        <jianyong.wu@....com>, <justin.he@....com>
Subject: Re: [RFC PATCH v2 02/35] drivers: base: Use present CPUs in
 GENERIC_CPU_DEVICES

On Thu, 14 Sep 2023 09:20:54 +0100
"Russell King (Oracle)" <linux@...linux.org.uk> wrote:

> On Wed, Sep 13, 2023 at 04:37:50PM +0000, James Morse wrote:
> > Three of the five ACPI architectures create sysfs entries using
> > register_cpu() for present CPUs, whereas arm64, riscv and all
> > GENERIC_CPU_DEVICES do this for possible CPUs.
> > 
> > Registering a CPU is what causes them to show up in sysfs.
> > 
> > It makes very little sense to register all possible CPUs. Registering
> > a CPU is what triggers the udev notifications allowing user-space to
> > react to newly added CPUs.
> > 
> > To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> > it to use for_each_present_cpu(). Making the ACPI architectures use
> > GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> > cpu_register() logic, before moving it into the ACPI processor driver.
> > When ACPI is disabled this work would be done by
> > cpu_dev_register_generic().
> > 
> > Of the ACPI architectures that register possible CPUs, arm64 and riscv
> > do not support making possible CPUs present as they use the weak 'always
> > fails' version of arch_register_cpu().
> > 
> > Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
> > distinction between present and possible CPUs.
> > 
> > The following architectures use GENERIC_CPU_DEVICES but are not SMP,
> > so possible == present:
> >  * m68k
> >  * microblaze
> >  * nios2
> > 
> > The following architectures use GENERIC_CPU_DEVICES and consider
> > possible == present:
> >  * csky: setup_smp()
> >  * parisc: smp_prepare_boot_cpu() marks the boot cpu as present,
> >    processor_probe() sets possible for all CPUs and present for all CPUs
> >    except the boot cpu.  
> 
> However, init/main.c::start_kernel() calls boot_cpu_init() which sets
> the boot CPU in the online, active, present and possible masks. So,
> _every_ architecture gets the boot CPU in all these masks no matter
> what.
> 
> Only of something then clears the boot CPU from these masks (which
> would be silly) would the boot CPU not be in all of these masks.
Hi Russel,

Upshot is that the code in parisc smp_prepare_boot_cpu() can be dropped?
Seems like another useful simplification to add to front of this series.
The function will end up with just a print then. 
Seems there are lots of other empty implementations of smp_prepare_boot_cpu()
maybe worth making that optional whilst here and dropping all the empty ones?

There seem to be some other architectures setting at least some of the cpu masks
that could perhaps be tidied up a little via same logic?

Jonathan

> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ